twx-linux/drivers/misc
Josh Poimboeuf db437e9854 objtool, lkdtm: Obfuscate the do_nothing() pointer
[ Upstream commit 05026ea01e95ffdeb0e5ac8fb7fb1b551e3a8726 ]

If execute_location()'s memcpy of do_nothing() gets inlined and unrolled
by the compiler, it copies one word at a time:

    mov    0x0(%rip),%rax    R_X86_64_PC32    .text+0x1374
    mov    %rax,0x38(%rbx)
    mov    0x0(%rip),%rax    R_X86_64_PC32    .text+0x136c
    mov    %rax,0x30(%rbx)
    ...

Those .text references point to the middle of the function, causing
objtool to complain about their lack of ENDBR.

Prevent that by resolving the function pointer at runtime rather than
build time.  This fixes the following warning:

  drivers/misc/lkdtm/lkdtm.o: warning: objtool: execute_location+0x23: relocation to !ENDBR: .text+0x1378

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Reviewed-by: Kees Cook <kees@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: https://lore.kernel.org/r/30b9abffbddeb43c4f6320b1270fa9b4d74c54ed.1742852847.git.jpoimboe@kernel.org
Closes: https://lore.kernel.org/oe-kbuild-all/202503191453.uFfxQy5R-lkp@intel.com/
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-05-02 07:50:56 +02:00
..
altera-stapl
bcm-vk Char/Misc driver changes for 6.6-rc1 2023-09-01 09:53:54 -07:00
c2port
cardreader Revert "drivers/card_reader/rtsx_usb: Restore interrupt based detection" 2025-03-13 12:58:33 +01:00
cb710
cxl Char/Misc driver changes for 6.6-rc1 2023-09-01 09:53:54 -07:00
echo
eeprom eeprom: digsy_mtc: Make GPIO lookup table match the device 2025-03-13 12:58:37 +01:00
genwqe misc: genwqe: make class_genwqe a static const structure 2023-08-11 21:41:33 +02:00
ibmasm ibm: convert to ctime accessor functions 2023-07-13 10:28:02 +02:00
lis3lv02d misc: lis3lv02d_i2c: Fix regulators getting en-/dis-abled twice on suspend/resume 2024-04-03 15:28:43 +02:00
lkdtm objtool, lkdtm: Obfuscate the do_nothing() pointer 2025-05-02 07:50:56 +02:00
mchp_pci1xxxx misc: microchip: pci1xxxx: Fix incorrect IRQ status handling during ack 2025-05-02 07:50:49 +02:00
mei mei: me: add panther lake H DID 2025-05-02 07:50:48 +02:00
ocxl mmu_notifiers: rename invalidate_range notifier 2023-08-18 10:12:41 -07:00
pvpanic misc/pvpanic-pci: register attributes via pci_driver 2024-06-12 11:12:35 +02:00
sgi-gru misc: sgi-gru: Don't disable preemption in GRU driver 2024-11-08 16:28:21 +01:00
sgi-xp
ti-st misc: st_core: Do not call kfree_skb() under spin_lock_irqsave() 2023-11-20 11:59:26 +01:00
uacce
vmw_vmci VMCI: Fix use-after-free when removing resource in vmci_resource_remove() 2024-09-12 11:11:41 +02:00
ad525x_dpot-i2c.c
ad525x_dpot-spi.c
ad525x_dpot.c
ad525x_dpot.h
apds990x.c misc: apds990x: Fix missing pm_runtime_disable() 2024-12-09 10:32:37 +01:00
apds9802als.c
atmel-ssc.c misc: atmel-ssc: Use devm_platform_get_and_ioremap_resource() 2023-08-04 15:38:45 +02:00
bh1770glc.c
cs5535-mfgpt.c
ds1682.c
dummy-irq.c
dw-xdata-pcie.c
enclosure.c
fastrpc.c misc: fastrpc: Fix copy buffer page size 2025-02-17 09:40:39 +01:00
gehc-achc.c
hi6421v600-irq.c misc: hi6421-spmi-pmic: Remove redundant dev_err() 2023-08-04 15:39:10 +02:00
hisi_hikey_usb.c
hmc6352.c
hpilo.c misc: hpilo: make ilo_class a static const structure 2023-08-11 21:41:36 +02:00
hpilo.h
ibmvmc.c ibm: convert to ctime accessor functions 2023-07-13 10:28:02 +02:00
ibmvmc.h
ics932s401.c
isl29003.c
isl29020.c
Kconfig misc: open-dice: make OPEN_DICE depend on HAS_IOMEM 2023-08-04 15:39:42 +02:00
kgdbts.c
lattice-ecp3-config.c
Makefile misc: tps6594-pfsm: Add driver for TI TPS6594 PFSM 2023-06-15 13:41:53 +02:00
open-dice.c misc: open-dice: Fix spurious lockdep warning 2024-03-01 13:34:51 +01:00
pch_phub.c
pci_endpoint_test.c misc: pci_endpoint_test: Fix 'irq_type' to convey the correct type 2025-04-25 10:45:55 +02:00
phantom.c
qcom-coincell.c misc: Explicitly include correct DT includes 2023-08-04 15:39:04 +02:00
smpro-errmon.c
smpro-misc.c
sram-exec.c
sram.c misc: Explicitly include correct DT includes 2023-08-04 15:39:04 +02:00
sram.h
tifm_7xx1.c
tifm_core.c
tps6594-esm.c Merge 6.5-rc6 into char-misc-next 2023-08-13 22:14:51 +02:00
tps6594-pfsm.c misc: tps6594: Remove redundant dev_err_probe() for platform_get_irq_byname() 2023-08-12 12:58:40 +02:00
tsl2550.c
vcpu_stall_detector.c misc: Explicitly include correct DT includes 2023-08-04 15:39:04 +02:00
vmw_balloon.c
xilinx_sdfec.c misc: Explicitly include correct DT includes 2023-08-04 15:39:04 +02:00
xilinx_tmr_inject.c misc: Explicitly include correct DT includes 2023-08-04 15:39:04 +02:00
xilinx_tmr_manager.c misc: Explicitly include correct DT includes 2023-08-04 15:39:04 +02:00