Unlock the pledge(2) system call
authorjca <jca@openbsd.org>
Wed, 29 Jun 2022 12:17:31 +0000 (12:17 +0000)
committerjca <jca@openbsd.org>
Wed, 29 Jun 2022 12:17:31 +0000 (12:17 +0000)
commitb20cffafd3a5430b1df20cdcd602d965bf7abbaa
treefb51331bb0093b65b7033d063782b5a331e6b9ff
parent72dc29cb42e42b51c90ae9be538617d336a4c77f
Unlock the pledge(2) system call

Protect the ps_pledge/ps_execpledge fields with ps_mtx.  Shuffle the
code to call unveil_destroy() outside the critical section.  Only writes
to those fields are protected.  Since we may only remove bits from those
fields, garbage values should do no harm even when a read crosses
a write on 32 bits systems.

Input claudio@ kettenis@ deraadt@, ok deraadt@
sys/kern/init_sysent.c
sys/kern/kern_pledge.c
sys/kern/syscalls.c
sys/kern/syscalls.master
sys/sys/proc.h
sys/sys/syscall.h
sys/sys/syscallargs.h