Lines Matching +full:signal +full:- +full:guard

1 // SPDX-License-Identifier: GPL-2.0
29 #include <signal.h>
35 #include <sys/signal.h>
148 ssp -= 8; in try_shstk()
161 try_shstk((unsigned long)shstk + SS_SIZE - 8); in test_shstk_pivot()
236 signal(SIGSEGV, SIG_DFL); in test_shstk_violation()
330 if (fd == -1) in test_gup()
338 printf("[INFO]\tGup read -> shstk access success\n"); in test_gup()
345 printf("[INFO]\tGup write -> shstk access success\n"); in test_gup()
352 printf("[INFO]\tGup read -> write access success\n"); in test_gup()
359 printf("[INFO]\tGup write -> write access success\n"); in test_gup()
368 if (fd == -1) in test_gup()
388 printf("[INFO]\tCow gup write -> write access success\n"); in test_gup()
392 signal(SIGSEGV, SIG_DFL); in test_gup()
419 printf("[FAIL]\tShadow stack access to read-only memory succeeded\n"); in test_mprotect()
425 * read-only. in test_mprotect()
446 signal(SIGSEGV, SIG_DFL); in test_mprotect()
529 signal(SIGSEGV, SIG_DFL); in test_userfaultfd()
537 signal(SIGSEGV, SIG_DFL); in test_userfaultfd()
548 * This tests whether mmap will place other mappings in a shadow stack's guard
554 * guard gap.
566 MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); in test_guard_gap_other_gaps()
575 MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); in test_guard_gap_other_gaps()
579 cur->mapping = test_map; in test_guard_gap_other_gaps()
581 cur->next = head; in test_guard_gap_other_gaps()
587 head = cur->next; in test_guard_gap_other_gaps()
588 munmap(cur->mapping, PAGE_SIZE); in test_guard_gap_other_gaps()
594 if (shstk - test_map - PAGE_SIZE != PAGE_SIZE) in test_guard_gap_other_gaps()
602 /* Tests respecting the guard gap of the mapping getting placed */
610 MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); in test_guard_gap_new_mappings_gaps()
615 MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); in test_guard_gap_new_mappings_gaps()
628 cur->mapping = test_map; in test_guard_gap_new_mappings_gaps()
630 cur->next = head; in test_guard_gap_new_mappings_gaps()
634 printf("[INFO]\tNew mapping has other mapping in guard gap!\n"); in test_guard_gap_new_mappings_gaps()
642 head = cur->next; in test_guard_gap_new_mappings_gaps()
643 munmap(cur->mapping, PAGE_SIZE); in test_guard_gap_new_mappings_gaps()
662 * Call 32 bit signal handler to get 32 bit signals ABI. Make sure
695 siglongjmp(jmp_buffer, -1); in segv_gp_handler()
709 sa32->sa_flags = SA_SIGINFO; in test_32bit()
725 sa32->sa_handler = (void *)sa32; in test_32bit()
745 err = -errno; in parse_uint_from_file()
751 err = err == EOF ? -EIO : -errno; in parse_uint_from_file()
783 return -errno; in get_uprobe_offset()
785 while (fscanf(f, "%zx-%zx %s %zx %*[^\n]\n", &start, &end, buf, &base) == 4) { in get_uprobe_offset()
795 return -ESRCH; in get_uprobe_offset()
797 return (uintptr_t)addr - start + base; in get_uprobe_offset()
823 if (type == -ENOENT) in test_uretprobe()
849 fd = syscall(__NR_perf_event_open, &attr, 0 /* pid */, -1 /* cpu */, in test_uretprobe()
850 -1 /* group_fd */, PERF_FLAG_FD_CLOEXEC); in test_uretprobe()
870 signal(SIGSEGV, SIG_DFL); in test_uretprobe()
912 while (waitpid(pid, &status, 0) != -1 && WSTOPSIG(status) != SIGTRAP); in test_ptrace()
993 printf("[SKIP]\tCould not re-enable Shadow stack\n"); in main()