linux/fs
Vasiliy Kulikov aa6afca5bc proc: fix races against execve() of /proc/PID/fd**
fd* files are restricted to the task's owner, and other users may not get
direct access to them.  But one may open any of these files and run any
setuid program, keeping opened file descriptors.  As there are permission
checks on open(), but not on readdir() and read(), operations on the kept
file descriptors will not be checked.  It makes it possible to violate
procfs permission model.

Reading fdinfo/* may disclosure current fds' position and flags, reading
directory contents of fdinfo/ and fd/ may disclosure the number of opened
files by the target task.  This information is not sensible per se, but it
can reveal some private information (like length of a password stored in a
file) under certain conditions.

Used existing (un)lock_trace functions to check for ptrace_may_access(),
but instead of using EPERM return code from it use EACCES to be consistent
with existing proc_pid_follow_link()/proc_pid_readlink() return code.  If
they differ, attacker can guess what fds exist by analyzing stat() return
code.  Patched handlers: stat() for fd/*, stat() and read() for fdindo/*,
readdir() and lookup() for fd/ and fdinfo/.

Signed-off-by: Vasiliy Kulikov <segoon@openwall.com>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: <stable@kernel.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-11-02 16:07:00 -07:00
..
9p net/9p: Convert net/9p protocol dumps to tracepoints 2011-10-24 11:13:12 -05:00
adfs
affs
afs
autofs4
befs
bfs
btrfs Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/hch/vfs-queue 2011-10-28 10:49:34 -07:00
cachefiles
ceph libceph: fix double-free of page vector 2011-10-25 16:10:17 -07:00
cifs Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/hch/vfs-queue 2011-10-28 10:49:34 -07:00
coda
configfs
cramfs
debugfs
devpts
dlm
ecryptfs treewide: use __printf not __attribute__((format(printf,...))) 2011-10-31 17:30:54 -07:00
efs
exofs ore: Enable RAID5 mounts 2011-10-24 17:22:29 -07:00
exportfs
ext2 treewide: use __printf not __attribute__((format(printf,...))) 2011-10-31 17:30:54 -07:00
ext3 Merge branch 'next' of git://selinuxproject.org/~jmorris/linux-security 2011-10-25 09:45:31 +02:00
ext4 treewide: use __printf not __attribute__((format(printf,...))) 2011-10-31 17:30:54 -07:00
fat fat: follow rename pack_hex_byte() to hex_byte_pack() 2011-10-31 17:30:57 -07:00
freevxfs
fscache
fuse
gfs2 treewide: use __printf not __attribute__((format(printf,...))) 2011-10-31 17:30:54 -07:00
hfs hfs: fix hfs_find_init() sb->ext_tree NULL ptr oops 2011-11-02 16:06:59 -07:00
hfsplus
hostfs
hpfs treewide: use __printf not __attribute__((format(printf,...))) 2011-10-31 17:30:54 -07:00
hppfs
hugetlbfs
isofs isofs: add readpages support 2011-11-02 16:06:59 -07:00
jbd
jbd2
jffs2
jfs Merge branch 'next' of git://selinuxproject.org/~jmorris/linux-security 2011-10-25 09:45:31 +02:00
lockd
logfs lib/string.c: introduce memchr_inv() 2011-10-31 17:30:47 -07:00
minix
ncpfs
nfs Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/hch/vfs-queue 2011-10-28 10:49:34 -07:00
nfs_common
nfsd nfs41: implement DESTROY_CLIENTID operation 2011-10-24 04:24:30 -04:00
nilfs2 treewide: use __printf not __attribute__((format(printf,...))) 2011-10-31 17:30:54 -07:00
nls
notify
ntfs treewide: use __printf not __attribute__((format(printf,...))) 2011-10-31 17:30:54 -07:00
ocfs2 treewide: use __printf not __attribute__((format(printf,...))) 2011-10-31 17:30:54 -07:00
omfs
openpromfs
partitions treewide: use __printf not __attribute__((format(printf,...))) 2011-10-31 17:30:54 -07:00
proc proc: fix races against execve() of /proc/PID/fd** 2011-11-02 16:07:00 -07:00
pstore pstore: make pstore write function return normal success/fail value 2011-10-12 09:17:24 -07:00
qnx4
quota
ramfs ramfs: remove module leftovers 2011-11-02 16:06:58 -07:00
reiserfs Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2011-10-25 12:11:02 +02:00
romfs
squashfs
sysfs sysfs: Make sysfs_rename safe with sysfs_dirents in rbtrees. 2011-11-01 09:16:14 -07:00
sysv
ubifs
udf treewide: use __printf not __attribute__((format(printf,...))) 2011-10-31 17:30:54 -07:00
ufs treewide: use __printf not __attribute__((format(printf,...))) 2011-10-31 17:30:54 -07:00
xfs treewide: use __printf not __attribute__((format(printf,...))) 2011-10-31 17:30:54 -07:00
aio.c Cross Memory Attach 2011-10-31 17:30:44 -07:00
anon_inodes.c
attr.c
bad_inode.c
binfmt_aout.c
binfmt_elf_fdpic.c
binfmt_elf.c binfmt_elf: fix PIE execution with randomization disabled 2011-11-02 16:06:58 -07:00
binfmt_em86.c
binfmt_flat.c
binfmt_misc.c
binfmt_script.c
binfmt_som.c
bio-integrity.c
bio.c
block_dev.c
buffer.c fs/buffer.c: add device information for error output in __find_get_block_slow() 2011-10-31 17:30:49 -07:00
char_dev.c
compat_binfmt_elf.c
compat_ioctl.c
compat.c Cross Memory Attach 2011-10-31 17:30:44 -07:00
dcache.c
dcookies.c
direct-io.c direct-io: merge direct_io_walker into __blockdev_direct_IO 2011-10-28 14:58:58 +02:00
drop_caches.c
eventfd.c
eventpoll.c epoll: fix spurious lockdep warnings 2011-10-31 17:30:57 -07:00
exec.c oom: remove oom_disable_count 2011-10-31 17:30:45 -07:00
fcntl.c
fhandle.c
fifo.c
file_table.c
file.c
filesystems.c
fs_struct.c
fs-writeback.c
generic_acl.c
inode.c vfs: fix spinning prevention in prune_icache_sb 2011-10-28 14:58:55 +02:00
internal.h
ioctl.c
ioprio.c
Kconfig tmpfs: add "tmpfs" to the Kconfig prompt to make it obvious. 2011-10-31 17:30:45 -07:00
Kconfig.binfmt
libfs.c
locks.c Merge branch 'for-3.2' of git://linux-nfs.org/~bfields/linux 2011-10-25 15:42:01 +02:00
Makefile fs/Makefile: Stupid typo breakage of exofs inclusion 2011-10-27 08:36:51 +02:00
mbcache.c
mpage.c
namei.c leases: fix write-open/read-lease race 2011-10-28 14:59:00 +02:00
namespace.c vfs: add "device" tag to /proc/self/mountstats 2011-10-28 13:55:08 +02:00
no-block.c
open.c leases: fix write-open/read-lease race 2011-10-28 14:59:00 +02:00
pipe.c fs/pipe.c: add ->statfs callback for pipefs 2011-10-31 17:30:51 -07:00
pnode.c
pnode.h
posix_acl.c vfs: pass all mask flags check_acl and posix_acl_permission 2011-10-28 14:58:54 +02:00
read_write.c Cross Memory Attach 2011-10-31 17:30:44 -07:00
read_write.h
readdir.c
select.c
seq_file.c
signalfd.c
splice.c
stack.c
stat.c
statfs.c
super.c vmscan: fix shrinker callback bug in fs/super.c 2011-10-31 17:30:49 -07:00
sync.c
timerfd.c
utimes.c
xattr_acl.c
xattr.c