Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

x86/uaccess: Don't leak AC flag into fentry from mcsafe_handle_tail()

After adding mcsafe_handle_tail() to the objtool uaccess safe list,
objtool reports:

arch/x86/lib/usercopy_64.o: warning: objtool: mcsafe_handle_tail()+0x0: call to __fentry__() with UACCESS enabled

With SMAP, this function is called with AC=1, so it needs to be careful
about which functions it calls. Disable the ftrace entry hook, which
can potentially pull in a lot of extra code.

Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/8e13d6f0da1c8a3f7603903da6cbf6d582bbfe10.1563413318.git.jpoimboe@redhat.com

authored by

Josh Poimboeuf and committed by
Thomas Gleixner
5e307a6b 3a6ab4bc

+1 -1
+1 -1
arch/x86/lib/usercopy_64.c
··· 60 60 * but reuse __memcpy_mcsafe in case a new read error is encountered. 61 61 * clac() is handled in _copy_to_iter_mcsafe(). 62 62 */ 63 - __visible unsigned long 63 + __visible notrace unsigned long 64 64 mcsafe_handle_tail(char *to, char *from, unsigned len) 65 65 { 66 66 for (; len; --len, to++, from++) {