Re: [PATCH] Convert filldir[64]() from __put_user() to unsafe_put_user()

From: Al Viro
Date: Tue Oct 08 2019 - 01:02:42 EST

On Mon, Oct 07, 2019 at 09:14:51PM -0700, Linus Torvalds wrote:
> On Mon, Oct 7, 2019 at 9:09 PM Linus Torvalds
> <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
> >
> > Try the attached patch, and then count the number of "rorx"
> > instructions in the kernel. Hint: not many. On my personal config,
> > this triggers 15 times in the whole kernel build (not counting
> > modules).
> So here's a serious patch that doesn't just mark things for counting -
> it just removes the cases entirely.
> Doesn't this look nice:
> 2 files changed, 2 insertions(+), 133 deletions(-)
> and it is one less thing to worry about when doing further cleanup.
> Seriously, if any of those __copy_{to,from}_user() constant cases were
> a big deal, we can turn them into get_user/put_user calls. But only
> after they show up as an actual performance issue.

Makes sense. I'm not arguing against doing that. Moreover, I suspect
that other architectures will be similar, at least once the
sigframe-related code for given architecture is dealt with. But that's
more of a "let's look at that later" thing (hopefully with maintainers
of architectures getting involved).