From: Matthew Wilcox <willy@infradead.org>
To: Pedro Falcato <pfalcato@suse.de>
Cc: vova tokarev <vladimirelitokarev@gmail.com>,
akpm@linux-foundation.org, security@kernel.org,
linux-mm@kvack.org, Alexander Viro <viro@zeniv.linux.org.uk>,
Christian Brauner <brauner@kernel.org>, Jan Kara <jack@suse.cz>,
Kees Cook <kees@kernel.org>,
linux-fsdevel@vger.kernel.org
Subject: Re: Fwd: BadBunny: UFFDIO_COPY shmem killpriv bypass leading to local privilege escalation
Date: Mon, 10 Aug 2026 05:05:44 +0100 [thread overview]
Message-ID: <anlOGOmO1HWVCMdF@casper.infradead.org> (raw)
In-Reply-To: <ancYCBUT8aB0qHwz@pedro-suse.lan>
On Sat, Aug 08, 2026 at 01:17:09PM +0100, Pedro Falcato wrote:
> I'm adding a bunch of fs people that might have opinions about this. Please
> see the rest of the thread below.
>
> On Sat, Aug 08, 2026 at 12:13:06PM +0300, vova tokarev wrote:
> > Pedro,
> >
> > Thanks for the review. Let me address both points.
> >
> > On the page fault comparison:
> >
> > UFFDIO_COPY is not comparable to a page fault. Page faults serve
> > existing page cache content (read-like). UFFDIO_COPY adds new,
>
> A page fault can also write to the page cache. On MAP_SHARED mappings.
>
> >
> > user-controlled content to the shmem page cache (write-like).
> >
> > The correct comparison is to write(), which calls file_modified()
> >
> > -> __remove_privs() to strip SUID/SGID.
> >
> >
> > This is exactly the reasoning used when fallocate() was fixed
> >
> > across XFS (commit fbe7e5200365), ext4, and f2fs to call
> >
> > file_modified(). The XFS commit message says:
> >
> > "as various fallocate modes can change the file contents [...]
> >
> > we should drop file privileges like suid just like we do for a
> >
> > regular write()"
>
> I can't speak for fallocate, or other system calls. As far as I'm aware,
> this is a best-effort kind of thing. As I said, writing to a MAP_SHARED
> mapping does not clear the setuid bit. It's a super trivial thing to do,
> too. But it's not a problem because setuid executables are not world-writable.
I mean, you're right. But maybe we should make a bit more of an effort?
I wouldn't like to see this used as part of a chain of exploits, and I
can just about see a path where a confused actor manages to create an
04777 executable.
All the tmpfs on my system are mounted nosuid, and many of them noexec too:
willy@deadly:~$ mount |grep tmp |wc -l
8
willy@deadly:~$ mount |grep tmp |grep nosuid |wc -l
8
willy@deadly:~$ mount |grep tmp |grep noexec |wc -l
4
This certainly isn't a hair-on-fire situation, it's just a place we
could do slightly better. Not so much BadBunny as MildlyMisbehavingMicrobe
prev parent reply other threads:[~2026-08-10 4:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CAGBKPgOm8q-8_rwyRPEmSj8JXdh_GaK1Q8vpJ=j-+yA0SgcNQw@mail.gmail.com>
2026-08-07 10:40 ` Fwd: BadBunny: UFFDIO_COPY shmem killpriv bypass leading to local privilege escalation vova tokarev
2026-08-07 14:14 ` Pedro Falcato
2026-08-08 9:13 ` vova tokarev
2026-08-08 12:17 ` Pedro Falcato
2026-08-10 4:05 ` Matthew Wilcox [this message]
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=anlOGOmO1HWVCMdF@casper.infradead.org \
--to=willy@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=brauner@kernel.org \
--cc=jack@suse.cz \
--cc=kees@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=pfalcato@suse.de \
--cc=security@kernel.org \
--cc=viro@zeniv.linux.org.uk \
--cc=vladimirelitokarev@gmail.com \
/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