* [PATCH] fs: add a comment explaining how MNT_NS_INTERNAL affects mnt_may_suid()
@ 2018-11-21 19:58 Jann Horn
2019-02-04 4:04 ` Jann Horn
0 siblings, 1 reply; 2+ messages in thread
From: Jann Horn @ 2018-11-21 19:58 UTC (permalink / raw)
To: Alexander Viro, jannh; +Cc: Andy Lutomirski, linux-kernel, linux-fsdevel
commit 380cf5ba6b0a ("fs: Treat foreign mounts as nosuid"), in addition to
the intended effect, also prevented suid execution of memfd files.
(And I think that's a good change.)
Signed-off-by: Jann Horn <jannh@google.com>
---
fs/namespace.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/fs/namespace.c b/fs/namespace.c
index a7f91265ea67..e68488426e42 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -3400,6 +3400,9 @@ bool mnt_may_suid(struct vfsmount *mnt)
* prevents namespaces from trusting potentially unsafe
* suid/sgid bits, file caps, or security labels that originate
* in other namespaces.
+ *
+ * check_mnt() rejects MNT_NS_INTERNAL mounts; this means that suid
+ * execution is blocked for files on internal mounts, e.g. memfds.
*/
return !(mnt->mnt_flags & MNT_NOSUID) && check_mnt(real_mount(mnt)) &&
current_in_userns(mnt->mnt_sb->s_user_ns);
--
2.20.0.rc0.387.gc7a69e6b6c-goog
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] fs: add a comment explaining how MNT_NS_INTERNAL affects mnt_may_suid()
2018-11-21 19:58 [PATCH] fs: add a comment explaining how MNT_NS_INTERNAL affects mnt_may_suid() Jann Horn
@ 2019-02-04 4:04 ` Jann Horn
0 siblings, 0 replies; 2+ messages in thread
From: Jann Horn @ 2019-02-04 4:04 UTC (permalink / raw)
To: Alexander Viro, Jann Horn; +Cc: Andy Lutomirski, kernel list, linux-fsdevel
On Wed, Nov 21, 2018 at 8:59 PM Jann Horn <jannh@google.com> wrote:
> commit 380cf5ba6b0a ("fs: Treat foreign mounts as nosuid"), in addition to
> the intended effect, also prevented suid execution of memfd files.
> (And I think that's a good change.)
Ping. Al, can you take this into your tree? fs/namespace.c is your stuff, right?
> Signed-off-by: Jann Horn <jannh@google.com>
> ---
> fs/namespace.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/fs/namespace.c b/fs/namespace.c
> index a7f91265ea67..e68488426e42 100644
> --- a/fs/namespace.c
> +++ b/fs/namespace.c
> @@ -3400,6 +3400,9 @@ bool mnt_may_suid(struct vfsmount *mnt)
> * prevents namespaces from trusting potentially unsafe
> * suid/sgid bits, file caps, or security labels that originate
> * in other namespaces.
> + *
> + * check_mnt() rejects MNT_NS_INTERNAL mounts; this means that suid
> + * execution is blocked for files on internal mounts, e.g. memfds.
> */
> return !(mnt->mnt_flags & MNT_NOSUID) && check_mnt(real_mount(mnt)) &&
> current_in_userns(mnt->mnt_sb->s_user_ns);
> --
> 2.20.0.rc0.387.gc7a69e6b6c-goog
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-02-04 4:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-21 19:58 [PATCH] fs: add a comment explaining how MNT_NS_INTERNAL affects mnt_may_suid() Jann Horn
2019-02-04 4:04 ` Jann Horn
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).