Re: [PATCH 0/3] vmsplice: make vmsplice a trivial wrapper for preadv2/pwritev2
From: Linus Torvalds
Date: Wed Jun 03 2026 - 14:33:06 EST
On Wed, 3 Jun 2026 at 11:10, Andy Lutomirski <luto@xxxxxxxxxxxxxx> wrote:
>
> So maybe we should make sure that, if we go down the route of
> disabling all the splice magic, that we leave an API, maybe the
> existing sendfile or maybe something else, that does an optimized copy
> from one fd to another and that is at least capable of sending from a
> file to the network with at most one CPU-side copy.
Why?
That is *LITERALLY* the attack surface - and the complexity - that we
should be removing.
sendfile() was a mistake. It is literally the "file->socket" thing
that has been buggy.
I absolutely refuse to get rid of splice code but keep the buggy sh*t
cases that caused all the problems in the first place.
Because *THAT* would just be completely insane and pointless.
> Even if we’re just doing that, I continue to find it strange that we
> require that a pipe be involved. What’s so special about pipes
Again: it was never splice or the pipe that was the problem. Stop
barking up the wrong tree.
It was "file data to socket" that was the truly horrendous issue.
That said, to explain the pipe: The reason for the pipe is to act as
the kernel-side buffer.
Now, these days we have much more capable iov_iter interfaces than we
used to, and in that sense the "pipe as a buffer" is certainly not the
obvious choice now.
But even then you need to have a *handle* to the buffers for the
general case, and that's what the pipe fd ends up then still
effectively being.
It was also done to avoid the M:N translation problem, because people
wanted to do zero-copy between other things than just "file ->
socket".
But again: we're ABNSOLUTELY NOT keeping that "file -> socket" thing
and getting rid of splice. That's literally keeping the bath-water
and throwing out the baby.
Splice is the *good* part (well, relatively - splice is bad too).
ile->socket needs to DIE IN A FIRE considering the security problems it has had.
I hope Jakub is right that the problems have been all fixed, and this
is all theoretical, but having seen just *how* many there were, I'm a
bit sceptical.
Because if people think splice is complicated, you haven't looked at
the skb rules. They are completely arbitrary and complex and spread
all over the tree.
Linus