ftrace/sorttable: Fix ftrace symbol table corruption with CONFIG_X86_KERNEL_IBT=y
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest27 patches 0 repliesNew
Patches in v1 No applies recorded yet
Reviews trailers per patch
1 of 27 patches has a Reviewed-by or Acked-by.
| Patch | Catalin Marinas | Nathan Chancellor |
|---|---|---|
| 1/27 | ||
| 2/27 | ||
| 3/27 | ||
| 4/27 | ||
| 5/27 | ||
| 6/27 | ||
| 7/27 | ||
| 8/27 | ||
| 9/27 | ||
| 10/27 | ||
| 11/27 | ||
| 12/27 | ||
| 13/27 | ||
| 14/27 | ||
| 15/27 | ||
| 16/27 | A-b | |
| 17/27 | ||
| 18/27 | ||
| 19/27 | ||
| 20/27 | ||
| 21/27 | ||
| 22/27 | ||
| 23/27 | T-b | |
| 24/27 | T-b | |
| 25/27 | T-b | |
| 26/27 | T-b | |
| 27/27 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH 6.12.y 00/27] ftrace/sorttable: Fix ftrace symbol table corruption with CONFIG_X86_KERNEL_IBT=y
This series backports the upstream fix for ftrace symbol table corruption on kernels with CONFIG_X86_KERNEL_IBT=y. Weak overridden functions corrupt the ftrace symbol table at boot, causing non-deterministic hook attachment failures across all ftrace consumers — most visibly fentry/trampoline-based hooks, but affecting any code that relies on ftrace symbol lookups.
The fix was merged to mainline in Linux 6.15 via:
https://lore.kernel.org/all/[email protected]/
The original backport request and bug description sent to stable:
https://lore.kernel.org/stable/CAOu3gNibeo3ov09CYpmzuqewB0EOsajB3hPU9pQmb_zoAUraHg@mail.gmail.com/
Red Hat independently backported this same set of patches to their RHEL 10 kernel (6.12). Their work is at:
https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-10/-/merge_requests/2689
The 27 patches are organized in four groups:
- Patches 01-14: sorttable.c rewrite (prereq, merged 6.14)
- Patch 15: function pointer struct cleanup (prereq, merged 6.14)
- Patches 16-21: the core IBT fix series (merged 6.15)
- Patches 22-27: post-merge correctness fixes for arm64 and s390
All patches applied cleanly to 6.12.y (at 6.12.93). Tested on x86_64 with CONFIG_X86_KERNEL_IBT=y:
grep __ftrace_invalid_address___ \
/sys/kernel/tracing/available_filter_functions | wc -l
Before: 589 After: 0ftrace kernel selftests (tools/testing/selftests/ftrace):
135 passed, 0 failed, 0 regressions introduced.
Guenter Roeck (1):
ftrace: Do not over-allocate ftrace memory
Steven Rostedt (25):
scripts/sorttable: Remove unused macro defines scripts/sorttable: Remove unused write functions scripts/sorttable: Remove unneeded Elf_Rel scripts/sorttable: Have the ORC code use the _r() functions to read scripts/sorttable: Make compare_extable() into two functions scripts/sorttable: Convert Elf_Ehdr to union scripts/sorttable: Replace Elf_Shdr Macro with a union scripts/sorttable: Convert Elf_Sym MACRO over to a union scripts/sorttable: Add helper functions for Elf_Ehdr scripts/sorttable: Add helper functions for Elf_Shdr scripts/sorttable: Add helper functions for Elf_Sym scripts/sorttable: Use uint64_t for mcount sorting scripts/sorttable: Move code from sorttable.h into sorttable.c scripts/sorttable: Get start/stop_mcount_loc from ELF file directly scripts/sorttable: Use a structure of function pointers for elf
helpers
arm64: scripts/sorttable: Implement sorting mcount_loc at boot for
arm64
scripts/sorttable: Have mcount rela sort use direct values scripts/sorttable: Always use an array for the mcount_loc sorting scripts/sorttable: Zero out weak functions in mcount_loc table
ftrace: Update the mcount_loc check of skipped entries
ftrace: Have ftrace pages output reflect freed pages
ftrace: Test mcount_loc addr before calling ftrace_call_addr()
ftrace: Check against is_kernel_text() instead of kaslr_offset() scripts/sorttable: Use normal sort if theres no relocs in the mcount
section
scripts/sorttable: Allow matches to functions before function entry
Vasily Gorbik (1):
scripts/sorttable: Fix endianness handling in build-time mcount sort
arch/arm64/Kconfig | 1 + kernel/trace/ftrace.c | 68 ++- scripts/link-vmlinux.sh | 4 +- scripts/sorttable.c | 1119 +++++++++++++++++++++++++++++++++++++-- scripts/sorttable.h | 500 ----------------- 5 files changed, 1133 insertions(+), 559 deletions(-) delete mode 100644 scripts/sorttable.h
Signature · 1 line
2.34.1