aboutsummaryrefslogtreecommitdiffstats
path: root/fs/namespace.c
Commit message (Collapse)AuthorAge
...
* | | vfs: move fsnotify junk to struct mountAl Viro2012-01-03
| | | | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | | vfs: move mnt_devnameAl Viro2012-01-03
| | | | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | | vfs: move mnt_list to struct mountAl Viro2012-01-03
| | | | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | | vfs: switch pnode.h macros to struct mount *Al Viro2012-01-03
| | | | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | | vfs: move the rest of int fields to struct mountAl Viro2012-01-03
| | | | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | | vfs: mnt_id/mnt_group_id movedAl Viro2012-01-03
| | | | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | | vfs: mnt_ns moved to struct mountAl Viro2012-01-03
| | | | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | | vfs: spread struct mount - mntput_no_expireAl Viro2012-01-03
| | | | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | | vfs: spread struct mount - do_add_mount and graft_treeAl Viro2012-01-03
| | | | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | | vfs: take mnt_share/mnt_slave/mnt_slave_list and mnt_expire to struct mountAl Viro2012-01-03
| | | | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | | vfs: and now we can make ->mnt_master point to struct mountAl Viro2012-01-03
| | | | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | | vfs: take mnt_master to struct mountAl Viro2012-01-03
| | | | | | | | | | | | | | | | | | make IS_MNT_SLAVE take struct mount * at the same time Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | | vfs: spread struct mount - remaining argument of mnt_set_mountpoint()Al Viro2012-01-03
| | | | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | | vfs: spread struct mount - propagate_mnt()Al Viro2012-01-03
| | | | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | | vfs: spread struct mount - get_dominating_id / do_make_slaveAl Viro2012-01-03
| | | | | | | | | | | | | | | | | | | | | next pile of horrors, similar to mnt_parent one; this time it's mnt_master. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | | vfs: take mnt_child/mnt_mounts to struct mountAl Viro2012-01-03
| | | | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | | vfs: all counters taken to struct mountAl Viro2012-01-03
| | | | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | | vfs: spread struct mount - work with countersAl Viro2012-01-03
| | | | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | | vfs: move mnt_mountpoint to struct mountAl Viro2012-01-03
| | | | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | | vfs: now it can be done - make mnt_parent point to struct mountAl Viro2012-01-03
| | | | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | | vfs: mnt_parent moved to struct mountAl Viro2012-01-03
| | | | | | | | | | | | | | | | | | the second victim... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | | vfs: spread struct mount - is_path_reachableAl Viro2012-01-03
| | | | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | | vfs: spread struct mount - mnt_has_parentAl Viro2012-01-03
| | | | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | | vfs: spread struct mount - do_umount/propagate_mount_busyAl Viro2012-01-03
| | | | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | | vfs: spread struct mount mnt_set_mountpoint child argumentAl Viro2012-01-03
| | | | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | | vfs: spread struct mount - clone_mnt/copy_tree argumentAl Viro2012-01-03
| | | | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | | vfs: spread struct mount - shrink_submounts/select_submountsAl Viro2012-01-03
| | | | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | | vfs: spread struct mount - umount_tree argumentAl Viro2012-01-03
| | | | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | | vfs: the first spoils - mnt_hash movedAl Viro2012-01-03
| | | | | | | | | | | | | | | | | | taken out of struct vfsmount into struct mount Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | | vfs: spread struct mount to remaining users of ->mnt_hashAl Viro2012-01-03
| | | | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | | vfs: spread struct mount - clone_mnt/copy_tree resultAl Viro2012-01-03
| | | | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | | vfs: spread struct mount - change_mnt_propagation/set_mnt_sharedAl Viro2012-01-03
| | | | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | | vfs: spread struct mount - alloc_vfsmnt/free_vfsmnt/mnt_alloc_id/mnt_free_idAl Viro2012-01-03
| | | | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | | vfs: spread struct mount - tree_contains_unbindableAl Viro2012-01-03
| | | | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | | vfs: spread struct mount - attach_recursive_mntAl Viro2012-01-03
| | | | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | | vfs: spread struct mount - mount group id handlingAl Viro2012-01-03
| | | | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | | vfs: spread struct mount - commit_treeAl Viro2012-01-03
| | | | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | | vfs: spread struct mount - attach_mnt/detach_mntAl Viro2012-01-03
| | | | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | | vfs: spread struct mount - namespace.c internal iteratorsAl Viro2012-01-03
| | | | | | | | | | | | | | | | | | | | | next_mnt() return value, first argument skip_mnt_tree() return value and argument Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | | vfs: spread struct mount - __lookup_mnt() resultAl Viro2012-01-03
| | | | | | | | | | | | | | | | | | switch __lookup_mnt() to returning struct mount *; callers adjusted. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | | vfs: start hiding vfsmount guts seriesAl Viro2012-01-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Almost all fields of struct vfsmount are used only by core VFS (and a fairly small part of it, at that). The plan: embed struct vfsmount into struct mount, making the latter visible only to core parts of VFS. Then move fields from vfsmount to mount, eventually leaving only mnt_root/mnt_sb/mnt_flags in struct vfsmount. Filesystem code still gets pointers to struct vfsmount and remains unchanged; all such pointers go to struct vfsmount embedded into the instances of struct mount allocated by fs/namespace.c. When fs/namespace.c et.al. get a pointer to vfsmount, they turn it into pointer to mount (using container_of) and work with that. This is the first part of series; struct mount is introduced, allocation switched to using it. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | | vfs: mnt_drop_write_file()Al Viro2012-01-03
| | | | | | | | | | | | | | | | | | | | | new helper (wrapper around mnt_drop_write()) to be used in pair with mnt_want_write_file(). Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | | vfs: make do_kern_mount() staticAl Viro2012-01-03
| | | | | | | | | | | | | | | | | | the only user outside of fs/namespace.c has died Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | | vfs: dentry_reset_mounted() doesn't use vfsmount argumentAl Viro2012-01-03
| | | | | | | | | | | | | | | | | | lose it Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | | unexport put_mnt_ns(), make create_mnt_ns() static outrightAl Viro2012-01-03
| | | | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | | vfs: more mnt_parent cleanupsAl Viro2012-01-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | a) mount --move is checking that ->mnt_parent is non-NULL before looking if that parent happens to be shared; ->mnt_parent is never NULL and it's not even an misspelled !mnt_has_parent() b) pivot_root open-codes is_path_reachable(), poorly. c) so does path_is_under(), while we are at it. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | | vfs: new internal helper: mnt_has_parent(mnt)Al Viro2012-01-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | vfsmounts have ->mnt_parent pointing either to a different vfsmount or to itself; it's never NULL and termination condition in loops traversing the tree towards root is mnt == mnt->mnt_parent. At least one place (see the next patch) is confused about what's going on; let's add an explicit helper checking it right way and use it in all places where we need it. Not that there had been too many, but... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | | vfs: kill pointless helpers in namespace.cAl Viro2012-01-03
| | | | | | | | | | | | | | | | | | | | | mnt_{inc,dec}_count() is not cleaner than doing the corresponding mnt_add_count() directly and mnt_set_count() is not used at all. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | | fix apparmor dereferencing potentially freed dentry, sanitize __d_path() APIAl Viro2011-12-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | __d_path() API is asking for trouble and in case of apparmor d_namespace_path() getting just that. The root cause is that when __d_path() misses the root it had been told to look for, it stores the location of the most remote ancestor in *root. Without grabbing references. Sure, at the moment of call it had been pinned down by what we have in *path. And if we raced with umount -l, we could have very well stopped at vfsmount/dentry that got freed as soon as prepend_path() dropped vfsmount_lock. It is safe to compare these pointers with pre-existing (and known to be still alive) vfsmount and dentry, as long as all we are asking is "is it the same address?". Dereferencing is not safe and apparmor ended up stepping into that. d_namespace_path() really wants to examine the place where we stopped, even if it's not connected to our namespace. As the result, it looked at ->d_sb->s_magic of a dentry that might've been already freed by that point. All other callers had been careful enough to avoid that, but it's really a bad interface - it invites that kind of trouble. The fix is fairly straightforward, even though it's bigger than I'd like: * prepend_path() root argument becomes const. * __d_path() is never called with NULL/NULL root. It was a kludge to start with. Instead, we have an explicit function - d_absolute_root(). Same as __d_path(), except that it doesn't get root passed and stops where it stops. apparmor and tomoyo are using it. * __d_path() returns NULL on path outside of root. The main caller is show_mountinfo() and that's precisely what we pass root for - to skip those outside chroot jail. Those who don't want that can (and do) use d_path(). * __d_path() root argument becomes const. Everyone agrees, I hope. * apparmor does *NOT* try to use __d_path() or any of its variants when it sees that path->mnt is an internal vfsmount. In that case it's definitely not mounted anywhere and dentry_path() is exactly what we want there. Handling of sysctl()-triggered weirdness is moved to that place. * if apparmor is asked to do pathname relative to chroot jail and __d_path() tells it we it's not in that jail, the sucker just calls d_absolute_path() instead. That's the other remaining caller of __d_path(), BTW. * seq_path_root() does _NOT_ return -ENAMETOOLONG (it's stupid anyway - the normal seq_file logics will take care of growing the buffer and redoing the call of ->show() just fine). However, if it gets path not reachable from root, it returns SEQ_SKIP. The only caller adjusted (i.e. stopped ignoring the return value as it used to do). Reviewed-by: John Johansen <john.johansen@canonical.com> ACKed-by: John Johansen <john.johansen@canonical.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Cc: stable@vger.kernel.org
* | | mount_subtree() pointless use-after-freeAl Viro2011-11-22
| | | | | | | | | | | | | | | | | | | | | | | | d'oh... we'd carefully pinned mnt->mnt_sb down, dropped mnt and attempt to grab s_umount on mnt->mnt_sb. The trouble is, *mnt might've been overwritten by now... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>