diff options
| author | Jinke Han <jinkehan@didiglobal.com> | 2026-09-08 15:37:42 +0800 |
|---|---|---|
| committer | Ingo Molnar <mingo@kernel.org> | 2026-09-17 09:48:42 +0200 |
| commit | a5f7a5bb3b7f28ba7e4fa246775b29a0e5537255 (patch) | |
| tree | 73fef824f9a846cf935869d0dbc5070ef6e2f741 /drivers/Makefile | |
| download | linux-stable-a5f7a5bb3b7f28ba7e4fa246775b29a0e5537255.tar.gz linux-stable-a5f7a5bb3b7f28ba7e4fa246775b29a0e5537255.zip | |
x86/kprobes: Fix crash when probing CS CALL instructionsgrafted
When using eBPF to probe CS CALL instructions within a function,
a crash can be triggered.
The eBPF tool probes offset 257 of the __hrtimer_run_queues()
function:
<__hrtimer_run_queues+249>: nopl 0x0(%rax,%rax,1)
<__hrtimer_run_queues+254>: mov %r14,%rdi
<__hrtimer_run_queues+257>: cs call <__x86_indirect_thunk_r12>
<__hrtimer_run_queues+263>: mov %eax,%r12d
<__hrtimer_run_queues+266>: xchg %ax,%ax
<__hrtimer_run_queues+268>: mov %r13,%rdi
Which triggers this crash:
BUG: unable to handle page fault for address: 00000000000f41c9
#PF: supervisor write access in kernel mode
#PF: error_code(0x0002) - not-present page
PGD 0 P4D 0
Oops: 0002 [#1] SMP NOPTI
CPU: 1 PID: 0 Comm: swapper/1 Kdump: loaded Tainted: P
RIP: 0010:__hrtimer_run_queues+0x106/0x230
Note that __hrtimer_run_queues+0x106 is __hrtimer_run_queues+262, which is
at the 6th byte of the above CS CALL instruction. Since the CS CALL
instruction occupies 6 bytes, the exception occurred in the middle of that
call instruction.
The root cause is that when using eBPF tools to probe in the middle of a
function, a kprobe with INT3 is used as the underlying implementation.
During single-step emulation of the original CALL instruction,
int3_emulate_call() assumes that the probed CALL instruction is 5 bytes
long. However, the actual CS-prefixed CALL instruction occupies 6 bytes,
so it constructs an incorrect exception return address. When the CPU
returns from the kprobe handler, the next instruction to be executed is at
the address of the last byte of that CS CALL instruction. Coincidentally,
starting from that address, the CPU fetches and decodes a completely
different instruction, which ultimately triggers a kernel crash.
Fix the issue by using the actual instruction length obtained from
the instruction decoder when constructing the exception return
address, rather than relying on the hardcoded CALL_INSN_SIZE macro.
[ mingo: Refined the changelog ]
Fixes: 6256e668b7af ("x86/kprobes: Use int3 instead of debug trap for single-step")
Suggested-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Jinke Han <jinkehan@didiglobal.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Reviewed-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Acked-by: Yafang Shao <laoar.shao@gmail.com>
Acked-by: Borislav Petkov <bp@alien8.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://patch.msgid.link/20260908073742.GA10517@didi-ThinkCentre-M920t-N000
Diffstat (limited to 'drivers/Makefile')
| -rw-r--r-- | drivers/Makefile | 200 |
1 files changed, 200 insertions, 0 deletions
diff --git a/drivers/Makefile b/drivers/Makefile new file mode 100644 index 000000000..0841ea851 --- /dev/null +++ b/drivers/Makefile @@ -0,0 +1,200 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# Makefile for the Linux kernel device drivers. +# +# 15 Sep 2000, Christoph Hellwig <hch@infradead.org> +# Rewritten to use lists instead of if-statements. +# + +obj-y += cache/ +obj-y += irqchip/ +obj-y += bus/ + +obj-y += phy/ + +# GPIO must come after pinctrl as gpios may need to mux pins etc +obj-$(CONFIG_PINCTRL) += pinctrl/ +obj-$(CONFIG_GPIOLIB) += gpio/ +obj-y += pwm/ + +# LEDs must come before PCI, it is needed by NPEM driver +obj-y += leds/ + +obj-y += pci/ + +obj-$(CONFIG_PARISC) += parisc/ +obj-$(CONFIG_RAPIDIO) += rapidio/ +obj-y += video/ +obj-y += idle/ + +# IPMI must come before ACPI in order to provide IPMI opregion support +obj-y += char/ipmi/ + +obj-$(CONFIG_ACPI) += acpi/ + +# PnP must come after ACPI since it will eventually need to check if acpi +# was used and do nothing if so +obj-$(CONFIG_PNP) += pnp/ +obj-y += amba/ + +obj-y += clk/ +# Many drivers will want to use DMA so this has to be made available +# really early. +obj-$(CONFIG_DMADEVICES) += dma/ + +# SOC specific infrastructure drivers. +obj-y += soc/ +obj-$(CONFIG_PM_GENERIC_DOMAINS) += pmdomain/ + +obj-y += virtio/ +obj-$(CONFIG_VDPA) += vdpa/ +obj-$(CONFIG_XEN) += xen/ + +# regulators early, since some subsystems rely on them to initialize +obj-$(CONFIG_REGULATOR) += regulator/ + +# reset controllers early, since gpu drivers might rely on them to initialize +obj-$(CONFIG_RESET_CONTROLLER) += reset/ + +# tty/ comes before char/ so that the VT console is the boot-time +# default. +obj-y += tty/ +obj-y += char/ + +# iommu/ comes before gpu as gpu are using iommu controllers +obj-y += iommu/ + +# gpu/ comes after char for AGP vs DRM startup and after iommu +obj-y += gpu/ + +obj-$(CONFIG_CONNECTOR) += connector/ + +# i810fb depends on char/agp/ +obj-$(CONFIG_FB_I810) += video/fbdev/i810/ + +obj-$(CONFIG_PARPORT) += parport/ +obj-y += base/ block/ misc/ mfd/ nfc/ +obj-$(CONFIG_LIBNVDIMM) += nvdimm/ +obj-y += dax/ +obj-$(CONFIG_DMA_SHARED_BUFFER) += dma-buf/ +obj-$(CONFIG_NUBUS) += nubus/ +obj-y += cxl/ +obj-y += macintosh/ +obj-y += scsi/ +obj-y += nvme/ +obj-$(CONFIG_ATA) += ata/ +obj-$(CONFIG_TARGET_CORE) += target/ +obj-$(CONFIG_MTD) += mtd/ +obj-$(CONFIG_SPI) += spi/ +obj-$(CONFIG_SPMI) += spmi/ +obj-$(CONFIG_HSI) += hsi/ +obj-$(CONFIG_SLIMBUS) += slimbus/ +obj-y += net/ +obj-$(CONFIG_ATM) += atm/ +obj-$(CONFIG_FUSION) += message/ +obj-y += firewire/ +obj-$(CONFIG_UIO) += uio/ +obj-$(CONFIG_VFIO) += vfio/ +obj-y += cdrom/ +obj-y += auxdisplay/ +obj-$(CONFIG_PCCARD) += pcmcia/ +obj-$(CONFIG_DIO) += dio/ +obj-$(CONFIG_SBUS) += sbus/ +obj-$(CONFIG_ZORRO) += zorro/ +obj-$(CONFIG_ATA_OVER_ETH) += block/aoe/ +obj-$(CONFIG_TC) += tc/ +obj-$(CONFIG_USB_PHY) += usb/ +obj-$(CONFIG_USB) += usb/ +obj-$(CONFIG_USB_SUPPORT) += usb/ +obj-$(CONFIG_PCI) += usb/ +obj-$(CONFIG_USB_GADGET) += usb/ +obj-$(CONFIG_OF) += usb/ +obj-$(CONFIG_SERIO) += input/serio/ +obj-$(CONFIG_GAMEPORT) += input/gameport/ +obj-$(CONFIG_INPUT) += input/ +obj-$(CONFIG_RTC_LIB) += rtc/ +obj-y += i2c/ i3c/ media/ +obj-$(CONFIG_PPS) += pps/ +obj-y += ptp/ +obj-$(CONFIG_W1) += w1/ +obj-y += power/ +obj-$(CONFIG_HWMON) += hwmon/ +obj-$(CONFIG_THERMAL) += thermal/ +obj-$(CONFIG_WATCHDOG) += watchdog/ +obj-$(CONFIG_MD) += md/ +obj-$(CONFIG_BT) += bluetooth/ +obj-$(CONFIG_ACCESSIBILITY) += accessibility/ +obj-$(CONFIG_EDAC) += edac/ +obj-$(CONFIG_EISA) += eisa/ +obj-$(CONFIG_PM_OPP) += opp/ +obj-$(CONFIG_CPU_FREQ) += cpufreq/ +obj-$(CONFIG_CPU_IDLE) += cpuidle/ +obj-y += mmc/ +obj-y += ufs/ +obj-$(CONFIG_MEMSTICK) += memstick/ +obj-$(CONFIG_INFINIBAND) += infiniband/ +obj-y += firmware/ +obj-$(CONFIG_FWCTL) += fwctl/ +obj-$(CONFIG_CRYPTO) += crypto/ +obj-$(CONFIG_SUPERH) += sh/ +obj-y += clocksource/ +obj-$(CONFIG_DCA) += dca/ +obj-$(CONFIG_HID_SUPPORT) += hid/ +obj-$(CONFIG_PPC_PS3) += ps3/ +obj-$(CONFIG_OF) += of/ +obj-$(CONFIG_SSB) += ssb/ +obj-$(CONFIG_BCMA) += bcma/ +obj-$(CONFIG_VHOST_RING) += vhost/ +obj-$(CONFIG_VHOST_IOTLB) += vhost/ +obj-$(CONFIG_VHOST) += vhost/ +obj-$(CONFIG_GREYBUS) += greybus/ +obj-$(CONFIG_COMEDI) += comedi/ +obj-$(CONFIG_GPIB) += gpib/ +obj-$(CONFIG_STAGING) += staging/ +obj-y += platform/ + +obj-$(CONFIG_MAILBOX) += mailbox/ +obj-$(CONFIG_HWSPINLOCK) += hwspinlock/ +obj-$(CONFIG_REMOTEPROC) += remoteproc/ +obj-$(CONFIG_RPMSG) += rpmsg/ +obj-$(CONFIG_SOUNDWIRE) += soundwire/ + +# Virtualization drivers +obj-y += virt/ +obj-$(CONFIG_HYPERV) += hv/ + +obj-$(CONFIG_PM_DEVFREQ) += devfreq/ +obj-$(CONFIG_EXTCON) += extcon/ +obj-$(CONFIG_MEMORY) += memory/ +obj-$(CONFIG_IIO) += iio/ +obj-$(CONFIG_IPACK_BUS) += ipack/ +obj-$(CONFIG_NTB) += ntb/ +obj-$(CONFIG_POWERCAP) += powercap/ +obj-$(CONFIG_MCB) += mcb/ +obj-$(CONFIG_PERF_EVENTS) += perf/ +obj-$(CONFIG_RAS) += ras/ +obj-$(CONFIG_USB4) += thunderbolt/ +obj-$(CONFIG_CORESIGHT) += hwtracing/coresight/ +obj-y += hwtracing/intel_th/ +obj-$(CONFIG_STM) += hwtracing/stm/ +obj-$(CONFIG_HISI_PTT) += hwtracing/ptt/ +obj-y += android/ +obj-$(CONFIG_NVMEM) += nvmem/ +obj-$(CONFIG_FPGA) += fpga/ +obj-$(CONFIG_FSI) += fsi/ +obj-$(CONFIG_TEE) += tee/ +obj-$(CONFIG_MULTIPLEXER) += mux/ +obj-$(CONFIG_SIOX) += siox/ +obj-$(CONFIG_GNSS) += gnss/ +obj-$(CONFIG_INTERCONNECT) += interconnect/ +obj-$(CONFIG_COUNTER) += counter/ +obj-$(CONFIG_MOST) += most/ +obj-$(CONFIG_PECI) += peci/ +obj-$(CONFIG_HTE) += hte/ +obj-$(CONFIG_DRM_ACCEL) += accel/ +obj-$(CONFIG_CDX_BUS) += cdx/ +obj-$(CONFIG_DPLL) += dpll/ +obj-y += resctrl/ + +obj-$(CONFIG_DIBS) += dibs/ +obj-$(CONFIG_S390) += s390/ |
