Files
kernel_google_wahoo/include/uapi/linux
Eric W. Biederman 62b004c983 fs: Better permission checking for submounts
commit 93faccbbfa958a9668d3ab4e30f38dd205cee8d8 upstream.

To support unprivileged users mounting filesystems two permission
checks have to be performed: a test to see if the user allowed to
create a mount in the mount namespace, and a test to see if
the user is allowed to access the specified filesystem.

The automount case is special in that mounting the original filesystem
grants permission to mount the sub-filesystems, to any user who
happens to stumble across the their mountpoint and satisfies the
ordinary filesystem permission checks.

Attempting to handle the automount case by using override_creds
almost works.  It preserves the idea that permission to mount
the original filesystem is permission to mount the sub-filesystem.
Unfortunately using override_creds messes up the filesystems
ordinary permission checks.

Solve this by being explicit that a mount is a submount by introducing
vfs_submount, and using it where appropriate.

vfs_submount uses a new mount internal mount flags MS_SUBMOUNT, to let
sget and friends know that a mount is a submount so they can take appropriate
action.

sget and sget_userns are modified to not perform any permission checks
on submounts.

follow_automount is modified to stop using override_creds as that
has proven problemantic.

do_mount is modified to always remove the new MS_SUBMOUNT flag so
that we know userspace will never by able to specify it.

autofs4 is modified to stop using current_real_cred that was put in
there to handle the previous version of submount permission checking.

cifs is modified to pass the mountpoint all of the way down to vfs_submount.

debugfs is modified to pass the mountpoint all of the way down to
trace_automount by adding a new parameter.  To make this change easier
a new typedef debugfs_automount_t is introduced to capture the type of
the debugfs automount function.

Fixes: 069d5ac9ae0d ("autofs:  Fix automounts by using current_real_cred()->uid")
Fixes: aeaa4a79ff6a ("fs: Call d_automount with the filesystems creds")
Reviewed-by: Trond Myklebust <trond.myklebust@primarydata.com>
Reviewed-by: Seth Forshee <seth.forshee@canonical.com>
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Change-Id: I09cb1f35368fb8dc4a64b5ac5a35c9d2843ef95b
2022-11-15 21:35:32 +01:00
..
2015-10-13 17:42:34 +02:00
2016-03-22 11:04:51 -07:00
2015-10-05 03:16:46 -07:00
2017-12-05 11:22:51 +01:00
2015-08-25 14:41:50 -05:00
2016-03-22 11:10:20 -07:00
2018-04-12 09:58:05 -07:00
2016-03-22 11:07:51 -07:00
2018-04-29 07:50:02 +02:00
2015-08-03 17:30:00 -07:00
2016-04-13 11:12:20 -07:00
2015-07-21 10:39:05 -07:00
2016-03-22 11:08:56 -07:00
2016-03-22 11:07:51 -07:00
2017-05-22 23:19:33 -07:00
2015-08-27 19:44:53 -04:00
2015-07-20 14:58:46 -04:00
2017-05-22 23:19:33 -07:00
2015-09-17 21:09:07 -07:00
2016-03-23 19:57:25 -07:00
2016-03-23 19:57:25 -07:00
2022-11-15 21:35:29 +01:00
2016-08-20 19:04:33 -07:00
2016-03-22 11:09:38 -07:00
2016-04-22 11:57:49 -07:00
2016-03-22 11:04:51 -07:00
2016-03-22 11:04:51 -07:00
2018-02-21 15:40:47 +00:00
2016-03-22 11:08:58 -07:00
2015-10-27 18:55:31 -07:00
2015-12-04 08:38:42 -07:00
2015-10-16 10:44:02 +02:00