Thread (27 messages) 27 messages, 6 authors, 2025-12-02

Re: [PATCH net-next] vhost: use "checked" versions of get_user() and put_user()

From: Jon Kohler <hidden>
Date: 2025-11-26 21:43:42
Also in: kvm, linux-arm-kernel, lkml, virtualization

On Nov 26, 2025, at 2:58 PM, Arnd Bergmann [off-list ref] wrote:

On Wed, Nov 26, 2025, at 20:47, Jon Kohler wrote:
quoted
quoted
On Nov 26, 2025, at 5:25 AM, Arnd Bergmann [off-list ref] wrote:
On Wed, Nov 26, 2025, at 07:04, Jason Wang wrote:
quoted
On Wed, Nov 26, 2025 at 3:45 AM Jon Kohler [off-list ref] wrote:
I think the more relevant commit is for 64-bit Arm here, but this does
the same thing, see 84624087dd7e ("arm64: uaccess: Don't bother
eliding access_ok checks in __{get, put}_user").
Ah! Right, this is definitely the important bit, as it makes it
crystal clear that these are exactly the same thing. The current
code is:
#define get_user __get_user
#define put_user __put_user

So, this patch changing from __* to regular versions is a no-op
on arm side of the house, yea?
Certainly on 64-bit, and almost always on 32-bit, yes.
quoted
quoted
I would think that if we change the __get_user() to get_user()
in this driver, the same should be done for the
__copy_{from,to}_user(), which similarly skips the access_ok()
check but not the PAN/SMAP handling.
Perhaps, thats a good call out. I’d file that under one battle
at a time. Let’s get get/put user dusted first, then go down
that road?
It depends on what your bigger plan is. Are you working on
improving the vhost driver specifically, or are you trying
to kill off the __get_user/__put_user calls across the
entire kernel?
I’m working on vhost / virtualized networking improvements
at the moment, not the broader kernel wide work.

Linus mentioned he might get into the mix and do a bulk
change and kill the whole thing once and for all, so I’m
simply trying to help knock an incremental amount of work
off the pile in advance of that (and reap some performance
benefits at the same time, at least on the x86 side).

Thanks for the info and back n forth here, I appreciate it!
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help