diff options
| author | 2018-04-12 17:13:34 +0000 | |
|---|---|---|
| committer | 2018-04-12 17:13:34 +0000 | |
| commit | 003f5e42bbc90263e30dbce6eb150fc5e31b56eb (patch) | |
| tree | 04d47971c19a950593b40d0a8bba6cc3c78f0cbd /sys/kern/init_main.c | |
| parent | Restore the original BSDI $Id$ strings. Those were mangled by CVS (diff) | |
| download | wireguard-openbsd-003f5e42bbc90263e30dbce6eb150fc5e31b56eb.tar.xz wireguard-openbsd-003f5e42bbc90263e30dbce6eb150fc5e31b56eb.zip | |
Implement MAP_STACK option for mmap(). Synchronous faults (pagefault and
syscall) confirm the stack register points at MAP_STACK memory, otherwise
SIGSEGV is delivered. sigaltstack() and pthread_attr_setstack() are modified
to create a MAP_STACK sub-region which satisfies alignment requirements.
Observe that MAP_STACK can only be set/cleared by mmap(), which zeroes the
contents of the region -- there is no mprotect() equivalent operation, so
there is no MAP_STACK-adding gadget.
This opportunistic software-emulation of a stack protection bit makes
stack-pivot operations during ROPchain fragile (kind of like removing a
tool from the toolbox).
original discussion with tedu, uvm work by stefan, testing by mortimer
ok kettenis
Diffstat (limited to 'sys/kern/init_main.c')
| -rw-r--r-- | sys/kern/init_main.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c index 17bff8830fb..87604c5b501 100644 --- a/sys/kern/init_main.c +++ b/sys/kern/init_main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: init_main.c,v 1.275 2018/03/20 15:45:32 mpi Exp $ */ +/* $OpenBSD: init_main.c,v 1.276 2018/04/12 17:13:44 deraadt Exp $ */ /* $NetBSD: init_main.c,v 1.84.4.1 1996/06/02 09:08:06 mrg Exp $ */ /* @@ -652,7 +652,7 @@ start_init(void *arg) if (uvm_map(&p->p_vmspace->vm_map, &addr, PAGE_SIZE, NULL, UVM_UNKNOWN_OFFSET, 0, UVM_MAPFLAG(PROT_READ | PROT_WRITE, PROT_MASK, MAP_INHERIT_COPY, - MADV_NORMAL, UVM_FLAG_FIXED|UVM_FLAG_OVERLAY|UVM_FLAG_COPYONW))) + MADV_NORMAL, UVM_FLAG_FIXED|UVM_FLAG_OVERLAY|UVM_FLAG_COPYONW|UVM_FLAG_STACK))) panic("init: couldn't allocate argument space"); for (pathp = &initpaths[0]; (path = *pathp) != NULL; pathp++) { |
