linux/fs/proc
Hugh Dickins 7c2c7d9930 fix setuid sometimes wouldn't
check_unsafe_exec() also notes whether the fs_struct is being
shared by more threads than will get killed by the exec, and if so
sets LSM_UNSAFE_SHARE to make bprm_set_creds() careful about euid.
But /proc/<pid>/cwd and /proc/<pid>/root lookups make transient
use of get_fs_struct(), which also raises that sharing count.

This might occasionally cause a setuid program not to change euid,
in the same way as happened with files->count (check_unsafe_exec
also looks at sighand->count, but /proc doesn't raise that one).

We'd prefer exec not to unshare fs_struct: so fix this in procfs,
replacing get_fs_struct() by get_fs_path(), which does path_get
while still holding task_lock, instead of raising fs->count.

Signed-off-by: Hugh Dickins <hugh@veritas.com>
Cc: stable@kernel.org
___

 fs/proc/base.c |   50 +++++++++++++++--------------------------------
 1 file changed, 16 insertions(+), 34 deletions(-)
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-03-28 17:30:00 -07:00
..
array.c
base.c fix setuid sometimes wouldn't 2009-03-28 17:30:00 -07:00
cmdline.c
cpuinfo.c
devices.c
generic.c constify dentry_operations: procfs 2009-03-27 14:44:01 -04:00
inode-alloc.txt
inode.c proc: proc_get_inode should de_put when inode already initialized 2009-02-23 18:25:32 -08:00
internal.h NOMMU: Make VMAs per MM as for MMU-mode linux 2009-01-08 12:04:47 +00:00
interrupts.c
Kconfig
kcore.c
kmsg.c
loadavg.c
Makefile
meminfo.c NOMMU: Make VMAs per MM as for MMU-mode linux 2009-01-08 12:04:47 +00:00
mmu.c
nommu.c NOMMU: Make VMAs per MM as for MMU-mode linux 2009-01-08 12:04:47 +00:00
page.c proc: fix kflags to uflags copying in /proc/kpageflags 2009-03-11 07:43:33 -07:00
proc_devtree.c
proc_net.c proc: stop using BKL 2009-01-05 12:27:44 +03:00
proc_sysctl.c constify dentry_operations: procfs 2009-03-27 14:44:01 -04:00
proc_tty.c
root.c vfs: simple_set_mnt() should return void 2009-03-27 14:44:03 -04:00
stat.c
task_mmu.c mm: report the MMU pagesize in /proc/pid/smaps 2009-01-06 15:58:58 -08:00
task_nommu.c NOMMU: Improve procfs output using per-MM VMAs 2009-01-08 12:04:47 +00:00
uptime.c
version.c
vmcore.c vmcore: remove saved_max_pfn check 2009-01-08 08:31:14 -08:00