Lines Matching +full:loss +full:- +full:of +full:- +full:signal
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 * Test that userspace stack is NX. Requires linking with -Wl,-z,noexecstack
20 * Fill the stack with INT3's and then try to execute some of them:
21 * SIGSEGV -- good, SIGTRAP -- bad.
30 #include <signal.h>
41 * This is memset(rsp, 0xcc, -1); but down.
42 * It will SIGSEGV when bottom of the stack is reached.
43 * Byte-size access is important! (see rdi tweak in the signal handler).
54 "mov $-1, %rcx\n"
57 "mov $-1, %ecx\n"
66 ".size make_stack1,.-make_stack1\n"
71 * memset(p, 0xcc, -1);
72 * It will SIGSEGV when top of the stack is reached.
82 "mov $-1, %rcx\n"
84 "mov $-1, %ecx\n"
93 ".size make_stack2,.-make_stack2\n"
115 * Some Linux versions didn't clear DF before entering signal in sigsegv()
125 stack_min_addr = ++uc->uc_mcontext.gregs[RDI]; in sigsegv()
129 uc->uc_mcontext.gregs[RIP] = (uintptr_t)&make_stack2; in sigsegv()
133 unsigned long stack_max_addr = uc->uc_mcontext.gregs[RDI]; in sigsegv()
138 uc->uc_mcontext.gregs[RIP] = stack_max_addr - PAGE_SIZE; in sigsegv()
141 /* Stack page is NX -- good, test next page. */ in sigsegv()
142 uc->uc_mcontext.gregs[RIP] -= PAGE_SIZE; in sigsegv()
143 if (uc->uc_mcontext.gregs[RIP] == stack_min_addr) { in sigsegv()
156 unsigned long rip = uc->uc_mcontext.gregs[RIP]; in sigtrap()
183 /* Cap stack at time-honored 8 MiB value. */ in main()
198 void *p = mmap(NULL, len, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0); in main()