Re: rename probe_kernel_* and probe_user_*

From: Linus Torvalds
Date: Wed Jun 17 2020 - 14:20:21 EST


On Wed, Jun 17, 2020 at 11:11 AM Linus Torvalds
<torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
>
> I'm actually a bit surprised that we don't even get a warning for that
> horrible pattern that smells a bit like the gcc 'cast as lvalue'
> thing.

Oh, it's because I once again got confused by the naming.

"get_kernel_nofault()" doesn't have the "get_user()" semantics despite
being written like it. The arguments are in the reverse order, and the
pointer cast is on the address, not the target.

It's more obvious in the code, but not when grepping for things and
being used to the (much MUCH more common) get_user() semantics.

I really think get_kernel_nofault() should reverse the order of
arguments, because right now that "[PATCH 3/3] maccess: rename
probe_kernel_address to get_kernel_nofault" is really really
confusing.

You rename the function to look and act like get_user() (except for
kernel accesses, of course), but you leave it with an argument order
that is very much the reverse of what get_user() has.

So no. I won't be merging this series after all.

Linus