Re: [PATCH] net: bypass ->sendpage for slab pages

From: David Miller
Date: Wed Aug 19 2020 - 15:07:16 EST


From: Christoph Hellwig <hch@xxxxxx>
Date: Wed, 19 Aug 2020 07:19:45 +0200

> Sending Slab or tail pages into ->sendpage will cause really strange
> delayed oops. Prevent it right in the networking code instead of
> requiring drivers to guess the exact conditions where sendpage works.
>
> Based on a patch from Coly Li <colyli@xxxxxxx>.
>
> Signed-off-by: Christoph Hellwig <hch@xxxxxx>

Yes this fixes the problem, but it doesn't in any way deal with the
callers who are doing this stuff.

They are all likely using sendpage because they expect that it will
avoid the copy, for performance reasons or whatever.

Now it won't.

At least with Coly's patch set, the set of violators was documented
and they could switch to allocating non-slab pages or calling
sendmsg() or write() instead.

I hear talk about ABIs just doing the right thing, but when their
value is increased performance vs. other interfaces it means that
taking a slow path silently is bad in the long term. And that's
what this proposed patch here does.