]> www.infradead.org Git - users/jedix/linux-maple.git/commit
x86/uaccess: Avoid barrier_nospec() in 64-bit copy_from_user()
authorLinus Torvalds <torvalds@linux-foundation.org>
Wed, 30 Oct 2024 02:03:31 +0000 (16:03 -1000)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 30 Oct 2024 21:38:10 +0000 (11:38 -1000)
commit0fc810ae3ae110f9e2fcccce80fc8c8d62f97907
tree983d3b661ca5c20363d7066b01252b6473ee95a3
parent14b7d43c5c068cb9688a9fe68883f4340effb053
x86/uaccess: Avoid barrier_nospec() in 64-bit copy_from_user()

The barrier_nospec() in 64-bit copy_from_user() is slow. Instead use
pointer masking to force the user pointer to all 1's for an invalid
address.

The kernel test robot reports a 2.6% improvement in the per_thread_ops
benchmark [1].

This is a variation on a patch originally by Josh Poimboeuf [2].

Link: https://lore.kernel.org/202410281344.d02c72a2-oliver.sang@intel.com
Link: https://lore.kernel.org/5b887fe4c580214900e21f6c61095adf9a142735.1730166635.git.jpoimboe@kernel.org
Tested-and-reviewed-by: Josh Poimboeuf <jpoimboe@kernel.org>
Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
include/linux/uaccess.h