Re: [PATCH 0/3] vmsplice: make vmsplice a trivial wrapper for preadv2/pwritev2
From: Linus Torvalds
Date: Wed Jun 10 2026 - 10:18:35 EST
On Tue, 9 Jun 2026 at 22:14, Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> wrote:
>
> How about using write access as the gate to zero copy?
Well, it's too late now - no sane user would open files for writing
just to read from them.
And if the file isn't opened for writing originally, it won't show up
in the fd. So we'd have to do some after-the-fact "is this writable
using the credentials we had at open time" thing.
Which we do for some /proc stuff etc, but it's disgusting, and it
isn't how any of this should work.
Plus honestly, in any *good* setup, the normal case really shouldn't
be that the source is writable anyway. In benchmarks, sure. But in
real life? Hell no.
If you're doing web serving of static content, your web server simply
should not have write access to what it is serving. If it does, your
web server setup is simply hot garbage and probably riddled with
security issues anyway, because you clearly spent absolutely zero time
on any kind of "minimal privileges" model.
(I'm not saying that splice would be primarily for web serving or that
serving static pages like that is an interesting load - I'm using it
purely as an example of why saying that writable files should get
better treatment is crazy: it's not how *any* of this should work at
any level at all).
So no. We should not treat writable files as some kind of preferred
model for performance. We should discourage that kind of behavior, not
encourage it.
Linus