linux/tools/objtool
Linus Torvalds d187a86de7 x86-64: rename misleadingly named '__copy_user_nocache()' function
This function was a masterclass in bad naming, for various historical
reasons.

It claimed to be a non-cached user copy.  It is literally _neither_ of
those things.  It's a specialty memory copy routine that uses
non-temporal stores for the destination (but not the source), and that
does exception handling for both source and destination accesses.

Also note that while it works for unaligned targets, any unaligned parts
(whether at beginning or end) will not use non-temporal stores, since
only words and quadwords can be non-temporal on x86.

The exception handling means that it _can_ be used for user space
accesses, but not on its own - it needs all the normal "start user space
access" logic around it.

But typically the user space access would be the source, not the
non-temporal destination.  That was the original intention of this,
where the destination was some fragile persistent memory target that
needed non-temporal stores in order to catch machine check exceptions
synchronously and deal with them gracefully.

Thus that non-descriptive name: one use case was to copy from user space
into a non-cached kernel buffer.  However, the existing users are a mix
of that intended use-case, and a couple of random drivers that just did
this as a performance tweak.

Some of those random drivers then actively misused the user copying
version (with STAC/CLAC and all) to do kernel copies without ever even
caring about the exception handling, _just_ for the non-temporal
destination.

Rename it as a first small step to actually make it halfway sane, and
change the prototype to be more normal: it doesn't take a user pointer
unless the caller has done the proper conversion, and the argument size
is the full size_t (it still won't actually copy more than 4GB in one
go, but there's also no reason to silently truncate the size argument in
the caller).

Finally, use this now sanely named function in the NTB code, which
mis-used a user copy version (with STAC/CLAC and all) of this interface
despite it not actually being a user copy at all.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2026-03-30 15:05:56 -07:00
..
Documentation Revert "objtool: Warn on functions with ambiguous -ffunction-sections section names" 2025-11-21 10:04:10 +01:00
arch objtool: Add Function to get the name of a CPU feature 2025-11-24 20:39:47 +01:00
include/objtool livepatch: Free klp_{object,func}_ext data after initialization 2026-02-05 08:00:45 -08:00
.gitignore objtool: Add Function to get the name of a CPU feature 2025-11-24 20:39:47 +01:00
Build objtool: Add more robust signal error handling, detect and warn about stack overflows 2025-12-03 19:42:37 +01:00
Makefile objtool: Fix libopcodes linking with static libraries 2026-01-21 20:25:14 +01:00
builtin-check.c objtool: Add wide output for disassembly 2025-11-24 20:40:48 +01:00
builtin-klp.c objtool/klp: Add post-link subcommand to finalize livepatch modules 2025-10-14 14:50:18 -07:00
check.c x86-64: rename misleadingly named '__copy_user_nocache()' function 2026-03-30 15:05:56 -07:00
disas.c objtool: Print bfd_vma as unsigned long long on ia32-x86_64 cross build 2026-01-27 08:19:35 -08:00
elf.c objtool: Replace custom macros in elf.c with shared ones 2026-01-27 08:20:41 -08:00
klp-diff.c objtool/klp: Fix symbol correlation for orphaned local symbols 2026-02-05 08:00:45 -08:00
klp-post-link.c objtool/klp: Add post-link subcommand to finalize livepatch modules 2025-10-14 14:50:18 -07:00
noreturns.h x86/smpboot: Mark native_play_dead() as __noreturn 2025-10-30 08:29:41 -07:00
objtool.c objtool: Add more robust signal error handling, detect and warn about stack overflows 2025-12-03 19:42:37 +01:00
orc_dump.c objtool: Add annotype() helper 2025-10-14 14:46:49 -07:00
orc_gen.c objtool: Add annotype() helper 2025-10-14 14:46:49 -07:00
signal.c objtool: Add more robust signal error handling, detect and warn about stack overflows 2025-12-03 19:42:37 +01:00
special.c objtool: Provide access to feature and flags of group alternatives 2025-11-21 15:30:14 +01:00
sync-check.sh objtool/klp: Introduce klp diff subcommand for diffing object files 2025-10-14 14:50:18 -07:00
trace.c objtool: Improve tracing of alternative instructions 2025-11-21 15:30:11 +01:00
weak.c objtool/klp: Introduce klp diff subcommand for diffing object files 2025-10-14 14:50:18 -07:00