linux/include
Huihui Huang ee5b8888d3 tracing: Prevent out-of-bounds read in glob matching
commit 0a6070839b upstream.

String event fields are not necessarily NUL-terminated, so the filter
predicate functions (filter_pred_string(), filter_pred_strloc() and
filter_pred_strrelloc()) pass the field length to the regex match
callbacks, and the length-aware matchers honour it.

regex_match_glob() was the exception: it ignored the length and called
glob_match(), which scans the string until it hits a NUL byte. Some
string fields are not NUL-terminated. One example is the dynamic char
array of the xfs_* namespace tracepoints, which is copied without a
trailing NUL. For such a field, glob matching reads past the end of
the event field, causing a KASAN slab-out-of-bounds read in
glob_match(), reached via regex_match_glob() and filter_match_preds()
from the xfs_lookup tracepoint.

Add a length-bounded glob_match_len() and use it from regex_match_glob()
so glob matching always stops at the field boundary. The matching loop
is factored into a shared helper so glob_match() keeps its behaviour.

Fixes: 60f1d5e3ba ("ftrace: Support full glob matching")
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/da1aaf125fc3b63320b0c540fd6afa7c3d5b4f1a.1782836943.git.hhhuang@smu.edu.sg
Reported-by: Yuan Tan <yuantan098@gmail.com>
Reported-by: Yifan Wu <yifanwucs@gmail.com>
Reported-by: Juefei Pu <tomapufckgml@gmail.com>
Reported-by: Zhengchuan Liang <zcliangcn@gmail.com>
Reported-by: Xin Liu <bird@lzu.edu.cn>
Assisted-by: Codex:GPT-5.4
Signed-off-by: Huihui Huang <hhhuang@smu.edu.sg>
Signed-off-by: Ren Wei <n05ec@lzu.edu.cn>
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
History 2026-07-24 15:51:25 +02:00
..
acpi ACPICA: Allow address_space_handler Install and _REG execution as 2 separate steps 2026-04-18 10:33:26 +02:00
asm-generic mm/hugetlb: fix excessive IPI broadcasts when unsharing PMD tables using mmu_gather 2026-04-18 10:33:18 +02:00
clocksource x86/hyperv: Fix hv tsc page based sched_clock for hibernation 2025-01-09 13:28:42 +01:00
crypto crypto: drbg - Fix drbg_max_addtl() on 64-bit kernels 2026-07-24 15:51:25 +02:00
drm drm/dp: Add eDP 1.5 bit definition 2026-06-19 13:33:25 +02:00
dt-bindings dt-bindings: clock: qcom,dispcc-sc7180: Define MDSS resets 2026-06-01 17:35:37 +02:00
keys keys: Pin request_key_auth payload in instantiate paths 2026-07-04 13:39:39 +02:00
kunit kunit: fix kernel-doc warnings due to mismatched arg names 2021-10-06 17:54:07 -06:00
kvm KVM: arm64: vgic-v4: Make the doorbell request robust w.r.t preemption 2024-07-05 09:14:51 +02:00
linux tracing: Prevent out-of-bounds read in glob matching 2026-07-24 15:51:25 +02:00
math-emu math-emu: Fix fall-through warning 2021-07-13 13:57:44 -05:00
media media: dvb-core: dmxdevfilter must always flush bufs 2026-03-04 07:20:01 -05:00
memory memory: renesas-rpc-if: Fix HF/OSPI data transfer in Manual Mode 2022-05-09 09:14:34 +02:00
misc ocxl: Update the Process Element Entry 2020-12-04 01:01:30 +11:00
net net: Drop the lock in skb_may_tx_timestamp() 2026-07-24 15:51:21 +02:00
pcmcia pcmcia: Replace zero-length array with flexible-array 2020-05-18 10:28:31 +02:00
ras Revert "mm/memory-failure.c: fix race with changing page compound again" 2022-07-12 16:35:17 +02:00
rdma RDMA: Move DMA block iterator logic into dedicated files 2026-06-19 13:33:49 +02:00
scsi scsi: libsas: Add sas_task_find_rq() 2025-10-19 16:21:40 +02:00
soc soc: qcom: rpmh-rsc: Enhance check for VRM in-flight request 2024-06-16 13:39:55 +02:00
sound ASoC: core: Do not call link_exit() on uninitialized rtd objects 2026-04-18 10:33:12 +02:00
target scsi: target: Fix multiple LUN_RESET handling 2023-05-11 23:00:26 +09:00
trace btrfs: tracepoints: fix sleep while in atomic context in btrfs_sync_file() 2026-06-01 17:35:43 +02:00
uapi net: phy: qcom: at803x: Use the correct bit to disable extended next page 2026-06-01 17:35:29 +02:00
vdso time64.h: Consolidated PSEC_PER_SEC definition 2021-04-06 16:32:17 -07:00
video fbdev: udlfb: add vm_ops to dlfb_ops_mmap to prevent use-after-free 2026-06-01 17:35:19 +02:00
xen xen: replace xen_remap() with memremap() 2025-07-17 18:30:48 +02:00