linux/fs
Oleg Nesterov abacd2fe3c coredump: set_dumpable: fix the theoretical race with itself
set_dumpable() updates MMF_DUMPABLE_MASK in a non-trivial way to ensure
that get_dumpable() can't observe the intermediate state, but this all
can't help if multiple threads call set_dumpable() at the same time.

And in theory commit_creds()->set_dumpable(SUID_DUMP_ROOT) racing with
sys_prctl()->set_dumpable(SUID_DUMP_DISABLE) can result in SUID_DUMP_USER.

Change this code to update both bits atomically via cmpxchg().

Note: this assumes that it is safe to mix bitops and cmpxchg.  IOW, if,
say, an architecture implements cmpxchg() using the locking (like
arch/parisc/lib/bitops.c does), then it should use the same locks for
set_bit/etc.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: Kees Cook <keescook@chromium.org>
Cc: Alex Kelly <alex.page.kelly@gmail.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Josh Triplett <josh@joshtriplett.org>
Cc: Petr Matousek <pmatouse@redhat.com>
Cc: Vasily Kulikov <segoon@openwall.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2014-01-23 16:37:01 -08:00
..
9p
adfs
affs
afs
autofs4 autofs: fix symlinks aren't checked for expiry 2014-01-23 16:36:59 -08:00
befs
bfs
btrfs xfs: update for v3.14-rc1 2014-01-23 09:16:20 -08:00
cachefiles
ceph
cifs
coda
configfs
cramfs
debugfs
devpts
dlm
ecryptfs
efivarfs
efs
exofs
exportfs
ext2
ext3
ext4 xfs: update for v3.14-rc1 2014-01-23 09:16:20 -08:00
f2fs f2fs: drop obsolete node page when it is truncated 2014-01-23 08:04:21 +09:00
fat
freevxfs
fscache
fuse fuse: support clients that don't implement 'open' 2014-01-22 19:36:59 +01:00
gfs2 GFS2: revert "GFS2: d_splice_alias() can't return error" 2014-01-18 09:50:53 +00:00
hfs
hfsplus hfsplus: remove hfsplus_file_lookup() 2014-01-23 16:37:00 -08:00
hostfs
hpfs
hppfs
hugetlbfs
isofs
jbd
jbd2
jffs2
jfs
kernfs kernfs: associate a new kernfs_node with its parent on creation 2014-01-17 11:50:07 -08:00
lockd
logfs logfs: check for the return value after calling find_or_create_page() 2014-01-23 16:36:54 -08:00
minix
ncpfs
nfs
nfs_common
nfsd
nilfs2 nilfs2: add comments for ioctls 2014-01-23 16:37:00 -08:00
nls
notify fsnotify: remove pointless NULL initializers 2014-01-21 16:19:41 -08:00
ntfs
ocfs2 ocfs2: fix NULL pointer dereference when dismount and ocfs2rec simultaneously 2014-01-21 16:19:42 -08:00
omfs
openpromfs
proc fs/proc/page.c: add PageAnon check to surely detect thp 2014-01-23 16:36:50 -08:00
pstore
qnx4
qnx6
quota
ramfs fs/ramfs: move ramfs_aops to inode.c 2014-01-23 16:36:58 -08:00
reiserfs remove extra definitions of U32_MAX 2014-01-23 16:36:55 -08:00
romfs
squashfs
sysfs Revert "kernfs, sysfs, driver-core: implement kernfs_remove_self() and its wrappers" 2014-01-13 14:05:13 -08:00
sysv
ubifs
udf
ufs
xfs xfs: Calling destroy_work_on_stack() to pair with INIT_WORK_ONSTACK() 2014-01-10 12:39:38 -06:00
aio.c
anon_inodes.c
attr.c
bad_inode.c
binfmt_aout.c
binfmt_elf_fdpic.c
binfmt_elf.c fs: binfmt_elf: remove unused defines INTERPRETER_NONE and INTERPRETER_ELF 2014-01-23 16:36:58 -08: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
char_dev.c
compat_binfmt_elf.c
compat_ioctl.c fs/compat_ioctl.c: fix an underflow issue (harmless) 2014-01-21 16:19:42 -08:00
compat.c
coredump.c
coredump.h
dcache.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace 2014-01-17 17:29:36 -08:00
dcookies.c
direct-io.c
drop_caches.c
eventfd.c
eventpoll.c epoll: do not take the nested ep->mtx on EPOLL_CTL_DEL 2014-01-02 14:40:30 -08:00
exec.c coredump: set_dumpable: fix the theoretical race with itself 2014-01-23 16:37:01 -08:00
fcntl.c
fhandle.c
file_table.c
file.c
filesystems.c
fs_struct.c
fs-writeback.c
generic_acl.c
inode.c
internal.h
ioctl.c
ioprio.c
Kconfig
Kconfig.binfmt
libfs.c
locks.c
Makefile
mbcache.c
mount.h
mpage.c
namei.c
namespace.c Driver core / sysfs patches for 3.14-rc1 2014-01-20 15:49:44 -08:00
no-block.c
open.c
pipe.c fs/pipe.c: skip file_update_time on frozen fs 2014-01-23 16:37:00 -08:00
pnode.c
pnode.h
posix_acl.c posix_acl: uninlining 2014-01-21 16:19:42 -08:00
proc_namespace.c
read_write.c fs/read_write.c:compat_readv(): remove bogus area verify 2014-01-21 16:19:42 -08:00
readdir.c
select.c
seq_file.c
signalfd.c
splice.c fuse: fix pipe_buf_operations 2014-01-22 19:36:57 +01:00
stack.c
stat.c
statfs.c
super.c fs/super.c: fix WARN on alloc_super() fail path 2014-01-21 16:19:42 -08:00
sync.c
timerfd.c
utimes.c
xattr_acl.c
xattr.c