linux/fs
Eric W. Biederman 7f61fd99a6 vfs: Test for and handle paths that are unreachable from their mnt_root
[ Upstream commit 397d425dc2 ]

In rare cases a directory can be renamed out from under a bind mount.
In those cases without special handling it becomes possible to walk up
the directory tree to the root dentry of the filesystem and down
from the root dentry to every other file or directory on the filesystem.

Like division by zero .. from an unconnected path can not be given
a useful semantic as there is no predicting at which path component
the code will realize it is unconnected.  We certainly can not match
the current behavior as the current behavior is a security hole.

Therefore when encounting .. when following an unconnected path
return -ENOENT.

- Add a function path_connected to verify path->dentry is reachable
  from path->mnt.mnt_root.  AKA to validate that rename did not do
  something nasty to the bind mount.

  To avoid races path_connected must be called after following a path
  component to it's next path component.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
History 2015-10-27 22:14:58 -04:00
..
9p 9p: don't leave a half-initialized inode sitting around 2015-08-04 14:41:56 -04:00
adfs adfs: add __printf verification, fix format/argument mismatches 2014-08-08 15:57:24 -07:00
affs move d_rcu from overlapping d_child to overlapping d_alias 2014-12-16 09:39:06 -08:00
afs Merge branch 'sched-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2014-10-13 16:23:15 +02:00
autofs4 autofs4 copy_dev_ioctl(): keep the value of ->size we'd used for allocation 2015-03-14 15:37:26 -04:00
befs fs/befs/btree.c: remove typedef befs_btree_node 2014-10-14 02:18:20 +02:00
bfs fs/bfs: use bfs prefix for dump_imap 2014-08-08 15:57:24 -07:00
btrfs Btrfs: update fix for read corruption of compressed and shared extents 2015-10-27 22:13:27 -04:00
cachefiles FS-Cache fixes 2014-10-14 08:40:15 +02:00
ceph ceph: do_sync is never initialized 2015-01-16 06:59:53 -08:00
cifs cifs: use server timestamp for ntlmv2 authentication 2015-10-27 22:14:00 -04:00
coda move d_rcu from overlapping d_child to overlapping d_alias 2014-12-16 09:39:06 -08:00
configfs fs/configfs: use pr_fmt 2014-06-04 16:53:53 -07:00
cramfs fs/cramfs/inode.c: use linux/uaccess.h 2014-08-08 15:57:25 -07:00
debugfs debugfs: leave freeing a symlink body until inode eviction 2015-03-14 15:37:27 -04:00
devpts fs/devpts/inode.c: convert printk to pr_foo() 2014-06-06 16:08:14 -07:00
dlm dlm: fix missing endian conversion of rcom_status flags 2014-10-14 15:11:48 -05:00
ecryptfs eCryptfs: don't pass fs-specific ioctl commands through 2015-03-23 21:02:51 -04:00
efivarfs efivarfs: Ensure VariableName is NUL-terminated 2015-06-28 13:39:26 -04:00
efs fs/efs/namei.c: return is not a function 2014-08-08 15:57:18 -07:00
exofs Boaz Harrosh - Fix broken email address 2014-10-19 20:22:32 +03:00
exportfs move d_rcu from overlapping d_child to overlapping d_alias 2014-12-16 09:39:06 -08:00
ext2 percpu_counter: add @gfp to percpu_counter_init() 2014-09-08 09:51:29 +09:00
ext3 ext3: Don't check quota format when there are no quota files 2014-10-22 09:02:48 +02:00
ext4 ext4: don't manipulate recovery flag when freezing no-journal fs 2015-10-27 09:33:09 -04:00
f2fs f2fs: fix possible data corruption in f2fs_write_begin() 2015-01-08 10:30:17 -08:00
fat fat: fix oops on corrupted vfat fs 2014-12-03 09:36:03 -08:00
freevxfs Major changes for 3.14 include support for the newly added ZERO_RANGE 2014-04-04 15:39:39 -07:00
fscache fs/fscache/object-list.c: use __seq_open_private() 2014-10-13 17:52:21 +01:00
fuse fuse: initialize fc->release before calling it 2015-07-05 10:12:55 -04:00
gfs2 GFS2: Fix crash during ACL deletion in acl max entry check in gfs2_set_acl() 2015-03-23 21:02:52 -04:00
hfs hfs,hfsplus: cache pages correctly between bnode_create and bnode_free 2015-10-07 10:23:45 -04:00
hfsplus hfs,hfsplus: cache pages correctly between bnode_create and bnode_free 2015-10-07 10:23:45 -04:00
hostfs hostfs: support rename flags 2014-08-07 14:40:09 -04:00
hpfs hpfs: update ctime and mtime on directory modification 2015-10-27 22:14:54 -04:00
hppfs clean up scary strncpy(dst, src, strlen(src)) uses 2013-07-03 16:07:41 -07:00
hugetlbfs fs/hugetlbfs/inode.c: remove null test before kfree 2014-06-04 16:54:11 -07:00
isofs isofs: Fix unchecked printing of ER records 2015-01-08 10:30:21 -08:00
jbd fs, jbd: use a more generic hash function 2014-10-22 10:02:04 +02:00
jbd2 jbd2: fix ocfs2 corrupt when updating journal superblock fails 2015-07-03 23:02:30 -04:00
jffs2 jffs2: fix handling of corrupted summary length 2015-03-06 14:53:05 -08:00
jfs Merge branch 'sched-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2014-10-13 16:23:15 +02:00
kernfs vfs: Remove unnecessary calls of check_submounts_and_drop 2014-10-09 02:38:56 -04:00
lockd SUNRPC: NULL utsname dereference on NFS umount during namespace cleanup 2015-03-06 14:52:58 -08:00
logfs fs/logfs/readwrite.c: kernel-doc warning fixes 2014-08-06 18:01:12 -07:00
minix minix zmap block counts calculation fix 2014-08-08 15:57:20 -07:00
ncpfs ncpfs: return proper error from NCP_IOC_SETROOT ioctl 2015-01-08 10:30:28 -08:00
nfs nfs/filelayout: Fix NULL reference caused by double freeing of fh_array 2015-10-27 22:14:26 -04:00
nfs_common lockd: move lockd's grace period handling into its own module 2014-09-17 16:33:11 -04:00
nfsd nfsd: do nfs4_check_fh in nfs4_check_file instead of nfs4_check_olstateid 2015-08-27 13:25:38 -04:00
nilfs2 nilfs2: fix sanity check of btree level in nilfs_btree_root_broken() 2015-05-23 15:43:03 -04:00
nls nls: have register_nls() set ->owner 2014-01-25 03:14:05 -05:00
notify fsnotify: fix oops in fsnotify_clear_marks_by_group_flags() 2015-08-19 13:16:07 -04:00
ntfs NTFS: Bump version to 2.1.31. 2014-10-16 12:53:35 +01:00
ocfs2 ocfs2/dlm: fix deadlock when dispatch assert master 2015-10-27 22:13:19 -04:00
omfs omfs: fix sign confusion for bitmap loop counter 2015-06-09 13:43:51 -04:00
openpromfs fs: push sync_filesystem() down to the file system's remount_fs() 2014-03-13 10:14:33 -04:00
overlayfs fix a braino in ovl_d_select_inode() 2015-10-27 22:14:25 -04:00
proc mnt: Refactor the logic for mounting sysfs and proc in a user namespace 2015-07-12 09:49:24 -04:00
pstore pstore-ram: Allow optional mapping with pgprot_noncached 2015-01-16 06:59:47 -08:00
qnx4 fs: push sync_filesystem() down to the file system's remount_fs() 2014-03-13 10:14:33 -04:00
qnx6 fs/qnx6: update debugging to current functions 2014-08-08 15:57:26 -07:00
quota quota: Store maximum space limit in bytes 2015-03-06 14:53:06 -08:00
ramfs fs/ramfs/file-nommu.c: replace count*size kzalloc by kcalloc 2014-08-08 15:57:18 -07:00
reiserfs reiserfs: destroy allocated commit workqueue 2015-01-16 06:59:53 -08:00
romfs fs/romfs/super.c: add blank line after declarations 2014-08-08 15:57:25 -07:00
squashfs fs/squashfs/super.c: logging cleanup 2014-08-06 18:01:13 -07:00
sysfs mnt: Refactor the logic for mounting sysfs and proc in a user namespace 2015-07-12 09:49:24 -04:00
sysv write_iter variants of {__,}generic_file_aio_write() 2014-05-06 17:38:00 -04:00
ubifs UBIFS: Fix trivial typo in power_cut_emulated() 2014-09-30 09:29:44 +03:00
udf udf: Check length of extended attributes and allocation descriptors 2015-03-06 14:53:02 -08:00
ufs fs/ufs: restore s_lock mutex_init() 2015-07-20 21:12:44 -04:00
xfs xfs: fix remote symlinks on V5/CRC filesystems 2015-07-05 10:12:47 -04:00
aio.c ioctx_alloc(): fix vma (and file) leak on failure 2015-04-24 17:14:06 -04:00
anon_inodes.c vfs: Allocate anon_inode_inode in anon_inode_init() 2014-03-27 09:52:54 -07:00
attr.c fs,userns: Change inode_capable to capable_wrt_inode_uidgid 2014-06-10 13:57:22 -07:00
bad_inode.c bad_inode: add ->rename2() 2014-08-07 14:40:09 -04:00
binfmt_aout.c handle suicide on late failure exits in execve() in search_binary_handler() 2014-10-09 02:39:00 -04:00
binfmt_elf.c fs/binfmt_elf.c:load_elf_binary(): return -EINVAL on zero-length mappings 2015-06-15 14:00:57 -04:00
binfmt_elf_fdpic.c handle suicide on late failure exits in execve() in search_binary_handler() 2014-10-09 02:39:00 -04:00
binfmt_em86.c file->f_op is never NULL... 2013-10-24 23:34:54 -04:00
binfmt_flat.c fs/binfmt_flat.c: make old_reloc() static 2014-06-04 16:54:21 -07:00
binfmt_misc.c binfmt_misc: work around gcc-4.9 warning 2014-10-14 02:18:16 +02:00
binfmt_script.c exec: do not leave bprm->interp on stack 2012-12-20 17:40:19 -08:00
binfmt_som.c get rid of pt_regs argument of ->load_binary() 2012-11-28 21:53:38 -05:00
block_dev.c Return short read or 0 at end of a raw device, not EIO 2014-10-31 06:33:26 -04:00
buffer.c fs: clarify rate limit suppressed buffer I/O errors 2014-10-21 13:55:11 -06:00
char_dev.c Merge branch 'for-3.13/core' of git://git.kernel.dk/linux-block 2013-11-14 12:08:14 +09:00
compat.c vfs: move getname() from callers to do_mount() 2014-10-09 02:39:16 -04:00
compat_binfmt_elf.c binfmt_elf: add ELF_HWCAP2 to compat auxv entries 2014-03-04 08:05:21 +00:00
compat_ioctl.c Bluetooth: Move HCI socket definitions into its own header file 2014-07-11 13:53:04 +03:00
coredump.c fs: if a coredump already exists, unlink and recreate with O_EXCL 2015-10-07 10:19:16 -04:00
dcache.c overlayfs: Make f_path always point to the overlay and f_inode to the underlay 2015-10-27 22:14:24 -04:00
dcookies.c fs/compat: fix lookup_dcookie() parameter handling 2014-01-29 16:22:40 -08:00
direct-io.c fuse: honour max_read and max_write in direct_io mode 2014-09-26 21:16:51 -04:00
drop_caches.c fs: convert use of typedef ctl_table to struct ctl_table 2014-06-06 16:08:16 -07:00
eventfd.c eventfd_ctx_fdget(): use fdget() instead of fget() 2014-01-25 03:13:04 -05:00
eventpoll.c eventpoll: fix uninitialized variable in epoll_ctl 2014-09-10 15:42:12 -07:00
exec.c parisc,metag: Fix crashes due to stack randomization on stack-grows-upwards architectures 2015-06-10 13:42:33 -04:00
fcntl.c security: make security_file_set_fowner, f_setown and __f_setown void return 2014-09-09 16:01:36 -04:00
fhandle.c vfs: read file_handle only once in handle_to_path 2015-06-10 13:42:44 -04:00
file.c Merge branch 'core-rcu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2014-10-13 15:44:12 +02:00
file_table.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2014-10-13 11:28:42 +02:00
filesystems.c sys_sysfs: Add CONFIG_SYSFS_SYSCALL 2014-04-03 16:21:05 -07:00
fs-writeback.c writeback: fix a subtle race condition in I_DIRTY clearing 2015-01-16 06:59:52 -08:00
fs_pin.c fs_pin: Allow for the possibility that m_list or s_list go unused. 2015-06-09 13:43:44 -04:00
fs_struct.c seqcount: Add lockdep functionality to seqcount/seqlock structures 2013-11-06 12:40:26 +01:00
inode.c fs: Fix S_NOSEC handling 2015-07-13 08:50:03 -04:00
internal.h overlayfs: Make f_path always point to the overlay and f_inode to the underlay 2015-10-27 22:14:24 -04:00
ioctl.c file->f_op is never NULL... 2013-10-24 23:34:54 -04:00
Kconfig overlay filesystem 2014-10-24 00:14:38 +02:00
Kconfig.binfmt fs: make binfmt support for #! scripts modular and removable 2013-04-30 17:04:04 -07:00
libfs.c move d_rcu from overlapping d_child to overlapping d_alias 2014-12-16 09:39:06 -08:00
locks.c locks: fix NULL-deref in generic_delete_lease 2015-01-27 08:29:40 -08:00
Makefile ovl: rename filesystem type to "overlay" 2014-11-20 16:39:59 +01:00
mbcache.c fs/mbcache: replace __builtin_log2() with ilog2() 2014-06-25 22:08:29 -04:00
mount.h vfs: Add a function to lazily unmount all mounts from any dentry. 2014-10-09 02:38:55 -04:00
mpage.c vfs: guard end of device for mpage interface 2014-10-09 22:25:53 -04:00
namei.c vfs: Test for and handle paths that are unreachable from their mnt_root 2015-10-27 22:14:58 -04:00
namespace.c vfs: Ignore unlocked mounts in fs_fully_visible 2015-07-20 21:12:43 -04:00
no-block.c llseek: automatically add .llseek fop 2010-10-15 15:53:27 +02:00
open.c overlayfs: Make f_path always point to the overlay and f_inode to the underlay 2015-10-27 22:14:24 -04:00
pipe.c new helper: copy_page_from_iter() 2014-05-06 17:39:42 -04:00
pnode.c get rid of propagate_umount() mistakenly treating slaves as busy. 2014-08-30 18:31:41 -04:00
pnode.h mnt: Improve the umount_tree flags 2015-05-17 19:12:08 -04:00
posix_acl.c posix_acl: handle NULL ACL in posix_acl_equiv_mode 2014-05-06 13:58:42 -04:00
proc_namespace.c namespaces: Use task_lock and not rcu to protect nsproxy 2014-07-29 18:08:50 -07:00
read_write.c cachefiles_write_page(): switch to __kernel_write() 2014-10-09 02:39:05 -04:00
readdir.c fanotify: create FAN_ACCESS event for readdir 2014-06-04 16:53:52 -07:00
select.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2013-11-13 15:34:18 +09:00
seq_file.c fs/seq_file: fallback to vmalloc allocation 2014-07-03 09:21:54 -07:00
signalfd.c signalfd: fix information leak in signalfd_copyinfo 2015-08-27 13:25:36 -04:00
splice.c vfs: export do_splice_direct() to modules 2014-10-24 00:14:35 +02:00
stack.c fs: fix comment for 'CONFIG_LBADF' 2014-08-26 09:35:56 +02:00
stat.c vfs: split out vfs_getattr_nosec 2013-11-09 00:16:31 -05:00
statfs.c vfs: allow O_PATH file descriptors for fstatfs() 2013-10-12 13:12:31 -07:00
super.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2014-10-13 11:28:42 +02:00
sync.c Export sync_filesystem() for modular ->remount_fs() use 2014-09-05 08:16:21 -07:00
timerfd.c timerfd: Remove an always true check 2014-08-27 11:17:48 +02:00
utimes.c locks: break delegations on any attribute modification 2013-11-09 00:16:44 -05:00
xattr.c vfs: Deduplicate code shared by xattr system calls operating on paths 2014-10-12 17:09:10 -04:00