diff options
-rw-r--r-- | sys/conf/files | 5 | ||||
-rw-r--r-- | sys/dev/systrace.c | 35 | ||||
-rw-r--r-- | sys/dev/systrace.h | 5 | ||||
-rw-r--r-- | sys/kern/Makefile | 6 |
4 files changed, 40 insertions, 11 deletions
diff --git a/sys/conf/files b/sys/conf/files index fad82898b2c..33c3020f736 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1,4 +1,4 @@ -# $OpenBSD: files,v 1.612 2016/02/28 15:46:18 naddy Exp $ +# $OpenBSD: files,v 1.613 2016/03/01 16:43:08 naddy Exp $ # $NetBSD: files,v 1.87 1996/05/19 17:17:50 jonathan Exp $ # @(#)files.newconf 7.5 (Berkeley) 5/10/93 @@ -974,9 +974,6 @@ file net/pfkeyv2.c key | ipsec | tcp_signature file net/pfkeyv2_parsemessage.c key | ipsec | tcp_signature file net/pfkeyv2_convert.c key | ipsec | tcp_signature -# COMPAT_* support code (base and other shared code) -file compat/common/compat_util.c !small_kernel - # libx86emu file dev/x86emu/x86emu.c x86emu file dev/x86emu/x86emu_util.c x86emu diff --git a/sys/dev/systrace.c b/sys/dev/systrace.c index 9b03bc21c01..05eef15dfa7 100644 --- a/sys/dev/systrace.c +++ b/sys/dev/systrace.c @@ -1,4 +1,4 @@ -/* $OpenBSD: systrace.c,v 1.77 2015/09/08 11:58:58 deraadt Exp $ */ +/* $OpenBSD: systrace.c,v 1.78 2016/03/01 16:43:08 naddy Exp $ */ /* * Copyright 2002 Niels Provos <provos@citi.umich.edu> * All rights reserved. @@ -48,7 +48,8 @@ #include <sys/poll.h> #include <sys/ptrace.h> -#include <compat/common/compat_util.h> +#include <sys/exec.h> +#include <uvm/uvm_extern.h> #include <dev/systrace.h> @@ -1811,3 +1812,33 @@ systrace_msg_policyfree(struct fsystrace *fst, struct str_policy *strpol) return (0); } + +caddr_t +stackgap_init(struct proc *p) +{ + struct process *pr = p->p_p; + + if (pr->ps_stackgap == 0) { + if (uvm_map(&pr->ps_vmspace->vm_map, &pr->ps_stackgap, + round_page(STACKGAPLEN), NULL, 0, 0, + UVM_MAPFLAG(PROT_READ | PROT_WRITE, PROT_READ | PROT_WRITE, + MAP_INHERIT_COPY, MADV_RANDOM, UVM_FLAG_COPYONW))) + sigexit(p, SIGILL); + } + + return (caddr_t)pr->ps_stackgap; +} + +void * +stackgap_alloc(caddr_t *sgp, size_t sz) +{ + void *n = (void *) *sgp; + caddr_t nsgp; + + sz = ALIGN(sz); + nsgp = *sgp + sz; + if (nsgp > (caddr_t)trunc_page((vaddr_t)n) + STACKGAPLEN) + return NULL; + *sgp = nsgp; + return n; +} diff --git a/sys/dev/systrace.h b/sys/dev/systrace.h index a94d4806458..62d7e8efa78 100644 --- a/sys/dev/systrace.h +++ b/sys/dev/systrace.h @@ -1,4 +1,4 @@ -/* $OpenBSD: systrace.h,v 1.25 2015/01/20 01:48:13 deraadt Exp $ */ +/* $OpenBSD: systrace.h,v 1.26 2016/03/01 16:43:08 naddy Exp $ */ /* * Copyright 2002 Niels Provos <provos@citi.umich.edu> * All rights reserved. @@ -236,5 +236,8 @@ void systrace_execve0(struct proc *); void systrace_execve1(char *, struct proc *); int systrace_scriptname(struct proc *, char *); +caddr_t stackgap_init(struct proc *); +void *stackgap_alloc(caddr_t *, size_t); + #endif /* _KERNEL */ #endif /* _SYSTRACE_H_ */ diff --git a/sys/kern/Makefile b/sys/kern/Makefile index 59278bcf7e2..cb40bc6a583 100644 --- a/sys/kern/Makefile +++ b/sys/kern/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.41 2015/12/01 15:32:29 deraadt Exp $ +# $OpenBSD: Makefile,v 1.42 2016/03/01 16:43:08 naddy Exp $ # Makefile for kernel tags files, init_sysent, etc. @@ -28,9 +28,7 @@ SYSTAGS=/var/db/sys_tags SYSDIR=/sys # Directories in which to place tags links (other than machine-dependent) -DGEN= compat compat/common \ - compat/linux \ - conf \ +DGEN= conf \ ddb \ dev dev/eisa dev/ic dev/isa dev/pci dev/pcmcia dev/cardbus \ dev/sun dev/tc \ |