diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2026-10-19 19:23:30 -1000 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2026-10-19 19:23:30 -1000 |
| commit | 94905fcbd9e225dd931aa543071d2fa55704206a (patch) | |
| tree | 686903cba687ce2f1937f0633f1fd80fa40ea01e /scripts/Makefile.thinlto | |
| parent | 9ef61ff7ca4cad2194eb3fd3de99a200f4038833 (diff) | |
| download | linux-94905fcbd9e225dd931aa543071d2fa55704206a.tar.gz linux-94905fcbd9e225dd931aa543071d2fa55704206a.zip | |
bpf: Use get_user() for kprobe_multi symbols and uprobe_multi arrays
copy_user_syms() and bpf_uprobe_multi_link_attach() check whole user
arrays with access_ok() up front, then read them one element at a time
with __get_user(), with other work in between: allocations and
strncpy_from_user() in copy_user_syms(), validation in the uprobe_multi
loop. Each of those accesses enables and disables user access on its
own, so the up-front check saves nothing. On x86, __get_user() is even
more expensive than get_user(): it does an lfence, where get_user()
checks the address with a couple of plain instructions.
Use get_user(). The access_ok() checks stay, because they also make a
bad array fail with -EFAULT before anything else is looked up or
allocated. Update the comment that said they were there for
__get_user().
This is part of getting rid of __get_user() and __put_user() entirely.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'scripts/Makefile.thinlto')
0 files changed, 0 insertions, 0 deletions
