• J
    lkdtm: Disable return thunks in rodata.c · efc72a66
    Josh Poimboeuf 提交于
    The following warning was seen:
    
      WARNING: CPU: 0 PID: 0 at arch/x86/kernel/alternative.c:557 apply_returns (arch/x86/kernel/alternative.c:557 (discriminator 1))
      Modules linked in:
      CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.19.0-rc4-00008-gee88d363 #1
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.0-debian-1.16.0-4 04/01/2014
      RIP: 0010:apply_returns (arch/x86/kernel/alternative.c:557 (discriminator 1))
      Code: ff ff 74 cb 48 83 c5 04 49 39 ee 0f 87 81 fe ff ff e9 22 ff ff ff 0f 0b 48 83 c5 04 49 39 ee 0f 87 6d fe ff ff e9 0e ff ff ff <0f> 0b 48 83 c5 04 49 39 ee 0f 87 59 fe ff ff e9 fa fe ff ff 48 89
    
    The warning happened when apply_returns() failed to convert "JMP
    __x86_return_thunk" to RET.  It was instead a JMP to nowhere, due to the
    thunk relocation not getting resolved.
    
    That rodata.o code is objcopy'd to .rodata, and later memcpy'd, so
    relocations don't work (and are apparently silently ignored).
    
    LKDTM is only used for testing, so the naked RET should be fine.  So
    just disable return thunks for that file.
    
    While at it, disable objtool and KCSAN for the file.
    
    Fixes: 0b53c374 ("x86/retpoline: Use -mfunction-return")
    Reported-by: Nkernel test robot <oliver.sang@intel.com>
    Debugged-by: NPeter Zijlstra <peterz@infradead.org>
    Signed-off-by: NJosh Poimboeuf <jpoimboe@kernel.org>
    Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
    Link: https://lore.kernel.org/lkml/Ys58BxHxoDZ7rfpr@xsang-OptiPlex-9020/
    efc72a66
Makefile 934 字节