Linux Hardening
 help / color / mirror / Atom feed
From: Pedro Falcato <pfalcato@suse.de>
To: Christian Brauner <brauner@kernel.org>,
	 Mateusz Guzik <mjguzik@gmail.com>
Cc: Jann Horn <jannh@google.com>, Jens Axboe <axboe@kernel.dk>,
	 Alexander Viro <viro@zeniv.linux.org.uk>,
	Jan Kara <jack@suse.cz>,
	linux-fsdevel@vger.kernel.org,  linux-kernel@vger.kernel.org,
	linux-mm@kvack.org, linux-hardening@vger.kernel.org,
	 Kees Cook <kees@kernel.org>
Subject: Re: [RFC PATCH] fs/splice: allow for a way to block splice() with read-only files
Date: Thu, 28 May 2026 13:59:58 +0100	[thread overview]
Message-ID: <ahg6JgO0wUkJKjRb@pedro-suse> (raw)
In-Reply-To: <20260522-haltestelle-laufpass-volltreffer-3c69a6d84fc4@brauner>

Hello,

Apologies for the delay (laziness^Wconferences, travel and the sort),

On Fri, May 22, 2026 at 03:11:11PM +0200, Christian Brauner wrote:
> On Tue, May 19, 2026 at 01:56:42PM +0200, Mateusz Guzik wrote:
> > On Tue, May 19, 2026 at 12:59 PM Christian Brauner <brauner@kernel.org> wrote:
> > >
> > > On 2026-05-19 12:51 +0200, Mateusz Guzik wrote:
> > > > How about denial of splice usage or degradation to copy are still on
> > > > the table, but based on a different criterion: whether code involved
> > > > is "known good" for lack of a better description. iow the kernel would
> > > > maintain a whitelist of "safe" cases. Random-ass AF_NOBODYEVERHEARDOF
> > > > does not make the cut.
> > >
> > > I had thought about that to but I felt a bit iffy about it. You could
> > > envision an FOP_* flag for this:
> > >
> > >   /* Module may use splice-like apis */
> > >   #define FOP_MAY_SPLICE          ((__force fop_flags_t)(1 << 8))

FWIW, I don't think this works. Sockets expose the same file_operations struct
for every socket. So while it could work for other dodgy fd's around the kernel, I
would hope there isn't many of them... (or at least many of them using splice,
etc).

> > >
> > > But that doesn't address how fundamentally broken vmsplice() for example
> > > really is and that probably no one should get to use it in its current
> > > form.

Right.

> > 
> > I never looked into the area on Linux, I am willing to take claims of
> > breakage on face value.
> > 
> > In this context I'm saying the functionality is used in the real world
> > for performance reasons and just whacking imo does not cut it.

Which is why I wanted to introduce the (admittedly, rather adhoc) approach
of limiting it to files that could already be written to. So hopefully it
could actually be deployed. I'm afraid many users out there will not deploy
a "go slower, safer" flag.

> > 
> > >
> > > > Common-case usage would have to be audited of course, but this sounds
> > > > rather actionable and would provide hardening without much friction.
> > >
> > > And that's the usual problem where rando module will just raise the
> > > flag. Maybe that's fine and we will keep up.
> > >
> > 
> > If this is a genuine worry the whitelist can still be introduced and
> > managed by one person (Linus?) very easily. The implementation is only
> > mildly cumbersome to get going and trivial to spread afterwards.
> > 
> > You could have something like this:
> > struct file_operations funky_ops = {
> > ....
> > };
> > VFS_FILE_OPS_REGISTER(funky_ops);
> 
> Unless someone is going to do that work a sysctl to force degrade all
> the APIs into copies should be ok.

Ok. It seems that the general consensus is KISS and just degrade everything
with the sysctl? I can do that for v2.

-- 
Pedro

  reply	other threads:[~2026-05-28 13:00 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-16 18:21 [RFC PATCH] fs/splice: allow for a way to block splice() with read-only files Pedro Falcato
2026-05-16 23:07 ` Matthew Wilcox
2026-05-17  0:59   ` Pedro Falcato
2026-05-17  1:17     ` Matthew Wilcox
2026-05-17  9:01       ` Pedro Falcato
2026-05-17 22:30         ` Matthew Wilcox
2026-05-16 23:51 ` Mateusz Guzik
2026-05-17  0:52   ` Pedro Falcato
2026-05-18 11:44   ` Christian Brauner
2026-05-18 12:20 ` Christian Brauner
2026-05-18 13:02   ` Pedro Falcato
2026-05-18 18:59   ` Jann Horn
2026-05-19  6:39     ` Christoph Hellwig
2026-05-19  9:49     ` Christian Brauner
2026-05-19 10:51       ` Mateusz Guzik
2026-05-19 10:59         ` Christian Brauner
2026-05-19 11:56           ` Mateusz Guzik
2026-05-22 13:11             ` Christian Brauner
2026-05-28 12:59               ` Pedro Falcato [this message]
2026-05-19 13:28         ` James Bottomley
2026-05-19 16:28         ` Jann Horn
2026-05-23 20:41       ` Askar Safin

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=ahg6JgO0wUkJKjRb@pedro-suse \
    --to=pfalcato@suse.de \
    --cc=axboe@kernel.dk \
    --cc=brauner@kernel.org \
    --cc=jack@suse.cz \
    --cc=jannh@google.com \
    --cc=kees@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mjguzik@gmail.com \
    --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