linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Christian Brauner <brauner@kernel.org>
To: Paul Moore <paul@paul-moore.com>
Cc: Ondrej Mosnacek <omosnace@redhat.com>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	linux-fsdevel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Andrea Arcangeli <aarcange@redhat.com>,
	Peter Xu <peterx@redhat.com>,
	David Hildenbrand <david@redhat.com>,
	Lokesh Gidra <lokeshgidra@google.com>,
	linux-mm@kvack.org, linux-security-module@vger.kernel.org,
	selinux@vger.kernel.org, linux-kernel@vger.kernel.org,
	Robert O'Callahan <roc@ocallahan.org>
Subject: Re: [RFC PATCH RESEND] userfaultfd: open userfaultfds with O_RDONLY
Date: Fri, 26 Aug 2022 10:43:54 +0200	[thread overview]
Message-ID: <20220826084354.a2jrrvni6mf7zzyw@wittgenstein> (raw)
In-Reply-To: <CAHC9VhRtLEg-xR5q33bVNOBi=54uJuix2QCZuCiKX2Qm6CaLzw@mail.gmail.com>

On Fri, Aug 19, 2022 at 02:50:57PM -0400, Paul Moore wrote:
> On Tue, Aug 16, 2022 at 6:12 PM Paul Moore <paul@paul-moore.com> wrote:
> > On Fri, Jul 8, 2022 at 5:35 AM Ondrej Mosnacek <omosnace@redhat.com> wrote:
> > >
> > > Since userfaultfd doesn't implement a write operation, it is more
> > > appropriate to open it read-only.
> > >
> > > When userfaultfds are opened read-write like it is now, and such fd is
> > > passed from one process to another, SELinux will check both read and
> > > write permissions for the target process, even though it can't actually
> > > do any write operation on the fd later.
> > >
> > > Inspired by the following bug report, which has hit the SELinux scenario
> > > described above:
> > > https://bugzilla.redhat.com/show_bug.cgi?id=1974559
> > >
> > > Reported-by: Robert O'Callahan <roc@ocallahan.org>
> > > Fixes: 86039bd3b4e6 ("userfaultfd: add new syscall to provide memory externalization")
> > > Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
> > > ---
> > >
> > > Resending as the last submission was ignored for over a year...
> > >
> > > https://lore.kernel.org/lkml/20210624152515.1844133-1-omosnace@redhat.com/T/
> > >
> > > I marked this as RFC, because I'm not sure if this has any unwanted side
> > > effects. I only ran this patch through selinux-testsuite, which has a
> > > simple userfaultfd subtest, and a reproducer from the Bugzilla report.
> > >
> > > Please tell me whether this makes sense and/or if it passes any
> > > userfaultfd tests you guys might have.
> > >
> > >  fs/userfaultfd.c | 4 ++--
> > >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > VFS folks, any objection to this patch?  It seems reasonable to me and
> > I'd really prefer this to go in via the vfs tree, but I'm not above
> > merging this via the lsm/next tree to get someone in vfs land to pay
> > attention to this ...
> 
> Okay, final warning, if I don't see any objections to this when I make
> my patch sweep next week I'm going to go ahead and merge this via the
> LSM tree.

Makes sense,
Acked-by: Christian Brauner (Microsoft) <brauner@kernel.org>


  reply	other threads:[~2022-08-26  8:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-08  9:34 Ondrej Mosnacek
2022-07-12 14:22 ` Peter Xu
2022-07-12 21:16   ` Paul Moore
2022-08-16 22:12 ` Paul Moore
2022-08-19 18:50   ` Paul Moore
2022-08-26  8:43     ` Christian Brauner [this message]
2022-08-30 20:10       ` Paul Moore

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220826084354.a2jrrvni6mf7zzyw@wittgenstein \
    --to=brauner@kernel.org \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=lokeshgidra@google.com \
    --cc=omosnace@redhat.com \
    --cc=paul@paul-moore.com \
    --cc=peterx@redhat.com \
    --cc=roc@ocallahan.org \
    --cc=selinux@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox