Have each thread keeps its own (counted!) reference to the process's ucreds
authorguenther <guenther@openbsd.org>
Fri, 18 Apr 2014 11:51:16 +0000 (11:51 +0000)
committerguenther <guenther@openbsd.org>
Fri, 18 Apr 2014 11:51:16 +0000 (11:51 +0000)
commita9ddc28608c80433f03eded670401243dac5208d
treeef25dcedbf9427970755f3d5be11e756e058e542
parent8b31bd26c8f03dd3312167a7f119ecf00c56d44e
Have each thread keeps its own (counted!) reference to the process's ucreds
to avoid possible use-after-free references when swapping ids in threaded
processes.  "Do I have the right creds?" checks are always made with the
threads creds.

Inspired by FreeBSD and NetBSD
"right time" deraadt@
25 files changed:
sys/arch/alpha/alpha/trap.c
sys/arch/amd64/amd64/trap.c
sys/arch/arm/arm/fault.c
sys/arch/hppa/hppa/trap.c
sys/arch/hppa64/hppa64/trap.c
sys/arch/i386/i386/trap.c
sys/arch/m88k/m88k/trap.c
sys/arch/mips64/mips64/trap.c
sys/arch/powerpc/powerpc/trap.c
sys/arch/sh/sh/trap.c
sys/arch/solbourne/solbourne/trap.c
sys/arch/sparc/sparc/trap.c
sys/arch/sparc64/sparc64/trap.c
sys/arch/vax/vax/trap.c
sys/dev/systrace.c
sys/kern/init_main.c
sys/kern/kern_exec.c
sys/kern/kern_exit.c
sys/kern/kern_fork.c
sys/kern/kern_prot.c
sys/kern/kern_sig.c
sys/sys/cdefs.h
sys/sys/proc.h
sys/sys/syscall_mi.h
sys/sys/ucred.h