From 1db99e90720bbce959331469de0aac7dcccdfddb Mon Sep 17 00:00:00 2001 From: deraadt Date: Thu, 5 Jan 2023 21:39:57 +0000 Subject: [PATCH] after a few trap.c were fixed to fault with the right access, the signal trampoline can now be PROT_EXEC (without PROT_READ) everywhere ok kettenis --- sys/kern/kern_exec.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index ca0ed3ce4f5..84185dc75c8 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_exec.c,v 1.240 2022/11/23 11:00:27 mbuhl Exp $ */ +/* $OpenBSD: kern_exec.c,v 1.241 2023/01/05 21:39:57 deraadt Exp $ */ /* $NetBSD: kern_exec.c,v 1.75 1996/02/09 18:59:28 christos Exp $ */ /*- @@ -826,9 +826,8 @@ exec_sigcode_map(struct process *pr) * memory) that we keep a permanent reference to and that we map * in all processes that need this sigcode. The creation is simple, * we create an object, add a permanent reference to it, map it in - * kernel space, copy out the sigcode to it and unmap it. - * Then we map it with PROT_READ|PROT_EXEC into the process just - * the way sys_mmap would map it. + * kernel space, copy out the sigcode to it and unmap it. Then we map + * it with PROT_EXEC into the process just the way sys_mmap would map it. */ if (sigobject == NULL) { extern int sigfillsiz; @@ -860,7 +859,7 @@ exec_sigcode_map(struct process *pr) pr->ps_sigcode = 0; /* no hint */ uao_reference(sigobject); if (uvm_map(&pr->ps_vmspace->vm_map, &pr->ps_sigcode, round_page(sz), - sigobject, 0, 0, UVM_MAPFLAG(PROT_READ | PROT_EXEC, + sigobject, 0, 0, UVM_MAPFLAG(PROT_EXEC, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_INHERIT_COPY, MADV_RANDOM, UVM_FLAG_COPYONW | UVM_FLAG_SYSCALL))) { uao_detach(sigobject); -- 2.20.1