<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux.git/fs/super.c, branch v5.3</title>
<subtitle>Linux kernel source tree</subtitle>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/'/>
<entry>
<title>Unbreak mount_capable()</title>
<updated>2019-07-31T16:22:32+00:00</updated>
<author>
<name>Al Viro</name>
<email>viro@zeniv.linux.org.uk</email>
</author>
<published>2019-07-27T12:29:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=c2c44ec20a8496f7a3b3401c092afe96908eced1'/>
<id>c2c44ec20a8496f7a3b3401c092afe96908eced1</id>
<content type='text'>
In "consolidate the capability checks in sget_{fc,userns}())" the
wrong argument had been passed to mount_capable() by sget_fc().
That mistake had been further obscured later, when switching
mount_capable() to fs_context has moved the calculation of
bogus argument from sget_fc() to mount_capable() itself.  It
should've been fc-&gt;user_ns all along.

Screwed-up-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Reported-by: Christian Brauner &lt;christian@brauner.io&gt;
Tested-by: Christian Brauner &lt;christian@brauner.io&gt;
Reviewed-by: David Howells &lt;dhowells@redhat.com&gt;
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In "consolidate the capability checks in sget_{fc,userns}())" the
wrong argument had been passed to mount_capable() by sget_fc().
That mistake had been further obscured later, when switching
mount_capable() to fs_context has moved the calculation of
bogus argument from sget_fc() to mount_capable() itself.  It
should've been fc-&gt;user_ns all along.

Screwed-up-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Reported-by: Christian Brauner &lt;christian@brauner.io&gt;
Tested-by: Christian Brauner &lt;christian@brauner.io&gt;
Reviewed-by: David Howells &lt;dhowells@redhat.com&gt;
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>convenience helper: get_tree_single()</title>
<updated>2019-07-05T02:01:58+00:00</updated>
<author>
<name>Al Viro</name>
<email>viro@zeniv.linux.org.uk</email>
</author>
<published>2019-05-23T01:23:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=c23a0bbab30cc1714b6b1d6a1c153a5ccab3f0d8'/>
<id>c23a0bbab30cc1714b6b1d6a1c153a5ccab3f0d8</id>
<content type='text'>
counterpart of mount_single(); switch fusectl to it

Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
counterpart of mount_single(); switch fusectl to it

Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>convenience helper get_tree_nodev()</title>
<updated>2019-07-05T02:01:58+00:00</updated>
<author>
<name>Al Viro</name>
<email>viro@zeniv.linux.org.uk</email>
</author>
<published>2019-06-02T00:48:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=2ac295d4f0c095310addbcb03d91d2a4c9f7d435'/>
<id>2ac295d4f0c095310addbcb03d91d2a4c9f7d435</id>
<content type='text'>
counterpart of mount_nodev().  Switch hugetlb and pseudo to it.

Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
counterpart of mount_nodev().  Switch hugetlb and pseudo to it.

Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>vfs: Kill sget_userns()</title>
<updated>2019-05-25T22:06:17+00:00</updated>
<author>
<name>David Howells</name>
<email>dhowells@redhat.com</email>
</author>
<published>2019-03-25T16:38:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=023d066a0d0a87696c04b0de2ceae53063d0b655'/>
<id>023d066a0d0a87696c04b0de2ceae53063d0b655</id>
<content type='text'>
Kill sget_userns(), folding it into sget() as that's the only remaining
user.

Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
cc: linux-fsdevel@vger.kernel.org
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Kill sget_userns(), folding it into sget() as that's the only remaining
user.

Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
cc: linux-fsdevel@vger.kernel.org
</pre>
</div>
</content>
</entry>
<entry>
<title>vfs: Provide sb-&gt;s_iflags settings in fs_context struct</title>
<updated>2019-05-25T22:00:03+00:00</updated>
<author>
<name>David Howells</name>
<email>dhowells@redhat.com</email>
</author>
<published>2019-03-25T16:38:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=c80fa7c8301c10ad10d997b9e86b4aeac5923b3e'/>
<id>c80fa7c8301c10ad10d997b9e86b4aeac5923b3e</id>
<content type='text'>
Provide a field in the fs_context struct through which bits in the
sb-&gt;s_iflags superblock field can be set.

Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
cc: linux-fsdevel@vger.kernel.org
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Provide a field in the fs_context struct through which bits in the
sb-&gt;s_iflags superblock field can be set.

Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
cc: linux-fsdevel@vger.kernel.org
</pre>
</div>
</content>
</entry>
<entry>
<title>move mount_capable() further out</title>
<updated>2019-05-25T22:00:02+00:00</updated>
<author>
<name>Al Viro</name>
<email>viro@zeniv.linux.org.uk</email>
</author>
<published>2019-05-13T16:57:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=c3aabf0780a506225b53bfe2b5177dd5dfec093d'/>
<id>c3aabf0780a506225b53bfe2b5177dd5dfec093d</id>
<content type='text'>
Call graph of vfs_get_tree():
	vfs_fsconfig_locked()	# neither kernmount, nor submount
	do_new_mount()		# neither kernmount, nor submount
	fc_mount()
		afs_mntpt_do_automount()	# submount
		mount_one_hugetlbfs()		# kernmount
		pid_ns_prepare_proc()		# kernmount
		mq_create_mount()		# kernmount
		vfs_kern_mount()
			simple_pin_fs()		# kernmount
			vfs_submount()		# submount
			kern_mount()		# kernmount
			init_mount_tree()
			btrfs_mount()
			nfs_do_root_mount()

	The first two need the check (unconditionally).
init_mount_tree() is setting rootfs up; any capability
checks make zero sense for that one.  And btrfs_mount()/
nfs_do_root_mount() have the checks already done in their
callers.

	IOW, we can shift mount_capable() handling into
the two callers - one in the normal case of mount(2),
another - in fsconfig(2) handling of FSCONFIG_CMD_CREATE.
I.e. the syscalls that set a new filesystem up.

Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Call graph of vfs_get_tree():
	vfs_fsconfig_locked()	# neither kernmount, nor submount
	do_new_mount()		# neither kernmount, nor submount
	fc_mount()
		afs_mntpt_do_automount()	# submount
		mount_one_hugetlbfs()		# kernmount
		pid_ns_prepare_proc()		# kernmount
		mq_create_mount()		# kernmount
		vfs_kern_mount()
			simple_pin_fs()		# kernmount
			vfs_submount()		# submount
			kern_mount()		# kernmount
			init_mount_tree()
			btrfs_mount()
			nfs_do_root_mount()

	The first two need the check (unconditionally).
init_mount_tree() is setting rootfs up; any capability
checks make zero sense for that one.  And btrfs_mount()/
nfs_do_root_mount() have the checks already done in their
callers.

	IOW, we can shift mount_capable() handling into
the two callers - one in the normal case of mount(2),
another - in fsconfig(2) handling of FSCONFIG_CMD_CREATE.
I.e. the syscalls that set a new filesystem up.

Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>move mount_capable() calls to vfs_get_tree()</title>
<updated>2019-05-25T22:00:01+00:00</updated>
<author>
<name>Al Viro</name>
<email>viro@zeniv.linux.org.uk</email>
</author>
<published>2019-05-12T22:16:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=059338aae33165179352a26b58d815801072c87d'/>
<id>059338aae33165179352a26b58d815801072c87d</id>
<content type='text'>
sget_fc() is called only from -&gt;get_tree() instances and
the only instance not calling it is legacy_get_tree(),
which calls mount_capable() directly.

In all sget_fc() callers the checks could be moved to the
very beginning of -&gt;get_tree() - -&gt;user_ns is not changed
in between.  So lifting the checks to the only caller of
-&gt;get_tree() is OK.

Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
sget_fc() is called only from -&gt;get_tree() instances and
the only instance not calling it is legacy_get_tree(),
which calls mount_capable() directly.

In all sget_fc() callers the checks could be moved to the
very beginning of -&gt;get_tree() - -&gt;user_ns is not changed
in between.  So lifting the checks to the only caller of
-&gt;get_tree() is OK.

Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>switch mount_capable() to fs_context</title>
<updated>2019-05-25T21:59:59+00:00</updated>
<author>
<name>Al Viro</name>
<email>viro@zeniv.linux.org.uk</email>
</author>
<published>2019-05-12T21:31:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=20284ab7427ffac514faf44fd9eb50e5745f4474'/>
<id>20284ab7427ffac514faf44fd9eb50e5745f4474</id>
<content type='text'>
	now both callers of mount_capable() have access to fs_context;
the only difference is that for sget_fc() we have the possibility
of fc-&gt;global being true, while for legacy_get_tree() it's guaranteed
to be impossible.  Unify to more generic variant...

Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	now both callers of mount_capable() have access to fs_context;
the only difference is that for sget_fc() we have the possibility
of fc-&gt;global being true, while for legacy_get_tree() it's guaranteed
to be impossible.  Unify to more generic variant...

Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>move the capability checks from sget_userns() to legacy_get_tree()</title>
<updated>2019-05-25T21:59:58+00:00</updated>
<author>
<name>Al Viro</name>
<email>viro@zeniv.linux.org.uk</email>
</author>
<published>2019-05-12T21:09:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=2527b284defaeadf74829b0b0bd3207ca7f165eb'/>
<id>2527b284defaeadf74829b0b0bd3207ca7f165eb</id>
<content type='text'>
1) all call chains leading to sget_userns() pass through -&gt;mount()
instances.
2) none of -&gt;mount() instances is ever called directly - the only
call site is legacy_get_tree()
3) all remaining -&gt;mount() instances end up calling sget_userns()

IOW, we might as well do the capability checks just before calling
-&gt;mount().  As for the arguments passed to mount_capable(),
in case of call chains to sget_userns() going through sget(),
we either don't call mount_capable() at all, or pass current_user_ns()
to it.  The call chains going through mount_pseudo_xattr() don't
call mount_capable() at all (SB_KERNMOUNT in flags on those).

That could've been split into smaller steps (lifting the checks
into sget(), then callers of sget(), then all the way to the
entries of every -&gt;mount() out there, then to the sole caller),
but that would be too much churn for little benefit...

Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
1) all call chains leading to sget_userns() pass through -&gt;mount()
instances.
2) none of -&gt;mount() instances is ever called directly - the only
call site is legacy_get_tree()
3) all remaining -&gt;mount() instances end up calling sget_userns()

IOW, we might as well do the capability checks just before calling
-&gt;mount().  As for the arguments passed to mount_capable(),
in case of call chains to sget_userns() going through sget(),
we either don't call mount_capable() at all, or pass current_user_ns()
to it.  The call chains going through mount_pseudo_xattr() don't
call mount_capable() at all (SB_KERNMOUNT in flags on those).

That could've been split into smaller steps (lifting the checks
into sget(), then callers of sget(), then all the way to the
entries of every -&gt;mount() out there, then to the sole caller),
but that would be too much churn for little benefit...

Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>vfs: Kill mount_ns()</title>
<updated>2019-05-25T21:59:57+00:00</updated>
<author>
<name>David Howells</name>
<email>dhowells@redhat.com</email>
</author>
<published>2019-03-25T16:38:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=bb7b6b2bbdb827e68cd506c8f5e3ba13215cccb2'/>
<id>bb7b6b2bbdb827e68cd506c8f5e3ba13215cccb2</id>
<content type='text'>
Kill mount_ns() as it has been replaced by vfs_get_super() in the new mount
API.

Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
cc: linux-fsdevel@vger.kernel.org
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Kill mount_ns() as it has been replaced by vfs_get_super() in the new mount
API.

Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
cc: linux-fsdevel@vger.kernel.org
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</pre>
</div>
</content>
</entry>
</feed>
