diff options
author | Renato Botelho <renato@netgate.com> | 2016-07-19 11:28:42 -0300 |
---|---|---|
committer | Renato Botelho <renato@netgate.com> | 2016-07-19 11:28:42 -0300 |
commit | d672f772561b19a87633a38b63c9b6b9ee457a3e (patch) | |
tree | ddb56ff0f93f58cbbbe2e088659df322eeb91960 /sys/compat/linux/linux_emul.c | |
parent | 0a721af42b1b08f07aac9419590a4906d5b1e8f8 (diff) | |
parent | 9a5d5ad86e4479378293a6598ce3e086d8abf1a8 (diff) | |
download | FreeBSD-src-d672f772561b19a87633a38b63c9b6b9ee457a3e.zip FreeBSD-src-d672f772561b19a87633a38b63c9b6b9ee457a3e.tar.gz |
Merge remote-tracking branch 'origin/stable/11' into devel-11
Diffstat (limited to 'sys/compat/linux/linux_emul.c')
-rw-r--r-- | sys/compat/linux/linux_emul.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/sys/compat/linux/linux_emul.c b/sys/compat/linux/linux_emul.c index c2bf3ae..b244eea 100644 --- a/sys/compat/linux/linux_emul.c +++ b/sys/compat/linux/linux_emul.c @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include <compat/linux/linux_emul.h> #include <compat/linux/linux_misc.h> +#include <compat/linux/linux_persona.h> #include <compat/linux/linux_util.h> @@ -127,7 +128,7 @@ linux_proc_init(struct thread *td, struct thread *newtd, int flags) /* epoll should be destroyed in a case of exec. */ pem = pem_find(p); KASSERT(pem != NULL, ("proc_exit: proc emuldata not found.\n")); - + pem->persona = 0; if (pem->epoll != NULL) { emd = pem->epoll; pem->epoll = NULL; @@ -220,6 +221,9 @@ linux_proc_exec(void *arg __unused, struct proc *p, struct image_params *imgp) { struct thread *td = curthread; struct thread *othertd; +#if defined(__amd64__) + struct linux_pemuldata *pem; +#endif /* * In a case of execing from linux binary properly detach @@ -243,6 +247,17 @@ linux_proc_exec(void *arg __unused, struct proc *p, struct image_params *imgp) linux_proc_init(td, NULL, 0); else linux_proc_init(td, td, 0); +#if defined(__amd64__) + /* + * An IA32 executable which has executable stack will have the + * READ_IMPLIES_EXEC personality flag set automatically. + */ + if (SV_PROC_FLAG(td->td_proc, SV_ILP32) && + imgp->stack_prot & VM_PROT_EXECUTE) { + pem = pem_find(p); + pem->persona |= LINUX_READ_IMPLIES_EXEC; + } +#endif } } |