diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-05-21 21:59:07 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-10-05 12:00:36 -0700 |
commit | 9f79b78ef74436c7507bac6bfb7b8b989263bccb (patch) | |
tree | 5deb7a6d15056c6ca31d911651ec7f74ac77c403 /fs/jffs2/debug.c | |
parent | 4d856f72c10ecb060868ed10ff1b1453943fc6c8 (diff) | |
download | linux-9f79b78ef74436c7507bac6bfb7b8b989263bccb.tar.bz2 |
Convert filldir[64]() from __put_user() to unsafe_put_user()
We really should avoid the "__{get,put}_user()" functions entirely,
because they can easily be mis-used and the original intent of being
used for simple direct user accesses no longer holds in a post-SMAP/PAN
world.
Manually optimizing away the user access range check makes no sense any
more, when the range check is generally much cheaper than the "enable
user accesses" code that the __{get,put}_user() functions still need.
So instead of __put_user(), use the unsafe_put_user() interface with
user_access_{begin,end}() that really does generate better code these
days, and which is generally a nicer interface. Under some loads, the
multiple user writes that filldir() does are actually quite noticeable.
This also makes the dirent name copy use unsafe_put_user() with a couple
of macros. We do not want to make function calls with SMAP/PAN
disabled, and the code this generates is quite good when the
architecture uses "asm goto" for unsafe_put_user() like x86 does.
Note that this doesn't bother with the legacy cases. Nobody should use
them anyway, so performance doesn't really matter there.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/jffs2/debug.c')
0 files changed, 0 insertions, 0 deletions