Re: [PATCH 03/11] fs: add new read_uptr and write_uptr file operations
From: Christoph Hellwig
Date: Wed Jun 24 2020 - 14:24:44 EST
On Wed, Jun 24, 2020 at 11:20:26AM -0700, Linus Torvalds wrote:
> On Wed, Jun 24, 2020 at 11:14 AM Christoph Hellwig <hch@xxxxxx> wrote:
> >
> > So we'd need new user copy functions for just those cases
>
> No. We'd open-code them. They'd look at "oh, I'm supposed to use a
> kernel pointer" and just use those.
>
> IOW, basically IN THE CODE that cares (and the whole argument is that
> this code is one or two special cases) you do
>
> /* This has not been converted to the new world order */
> if (get_fs() == KERNEL_DS) memcpy(..) else copy_from_user();
>
> You're overdesigning things. You're making them more complex than they
> need to be.
I wish it was so simple. I really don't like overdesigns, trust me.
But please take a look at setsockopt and all the different instances
(count 90 .setsockopt wireups, and they then branch out into
various subroutines as well). I really don't want to open code that
there, but we could do helper specific to setsockopt.
Honestly my preference would be to say that no eBPF isn't actually
a user API and just rip out the crap added to it, but I fear that
is not an option. Because in that case we'd basically be done.
> Basically, I do *NOT* want to pollute the VFS layer with new
> interfaces that shouldn't exist in the long run. I'd much rather make
> the eventual goal be to get rid of 'read/write' entirely in favour of
> the 'iter' things, but what I absolutely do *NOT* want to see is to
> make a _third_ interface for reading and writing. Quite the reverse.
> We should strive to make it a _single_ interface, not add a new one.
Completele agreement on this. I actually hate the new fops, and only
added them reluctantly as I mis-interpreted what you said.