Linux kernel -stable discussions
 help / color / mirror / Atom feed
* [PATCH 6.12.y 00/27] ftrace/sorttable: Fix ftrace symbol table corruption with CONFIG_X86_KERNEL_IBT=y
@ 2026-06-18 20:15 Andrey Grodzovsky
  2026-06-18 20:15 ` [PATCH 6.12.y 01/27] scripts/sorttable: Remove unused macro defines Andrey Grodzovsky
                   ` (26 more replies)
  0 siblings, 27 replies; 28+ messages in thread
From: Andrey Grodzovsky @ 2026-06-18 20:15 UTC (permalink / raw)
  To: stable
  Cc: gregkh, sashal, rostedt, vmalik, jmarchan, martin.kelly,
	justin.deschamp, linux-open-source

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/20250218195918.255228630@goodmis.org/

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: 0

ftrace 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

-- 
2.34.1


^ permalink raw reply	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2026-06-18 20:46 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-18 20:15 [PATCH 6.12.y 00/27] ftrace/sorttable: Fix ftrace symbol table corruption with CONFIG_X86_KERNEL_IBT=y Andrey Grodzovsky
2026-06-18 20:15 ` [PATCH 6.12.y 01/27] scripts/sorttable: Remove unused macro defines Andrey Grodzovsky
2026-06-18 20:15 ` [PATCH 6.12.y 02/27] scripts/sorttable: Remove unused write functions Andrey Grodzovsky
2026-06-18 20:15 ` [PATCH 6.12.y 03/27] scripts/sorttable: Remove unneeded Elf_Rel Andrey Grodzovsky
2026-06-18 20:15 ` [PATCH 6.12.y 04/27] scripts/sorttable: Have the ORC code use the _r() functions to read Andrey Grodzovsky
2026-06-18 20:15 ` [PATCH 6.12.y 05/27] scripts/sorttable: Make compare_extable() into two functions Andrey Grodzovsky
2026-06-18 20:15 ` [PATCH 6.12.y 06/27] scripts/sorttable: Convert Elf_Ehdr to union Andrey Grodzovsky
2026-06-18 20:15 ` [PATCH 6.12.y 07/27] scripts/sorttable: Replace Elf_Shdr Macro with a union Andrey Grodzovsky
2026-06-18 20:15 ` [PATCH 6.12.y 08/27] scripts/sorttable: Convert Elf_Sym MACRO over to " Andrey Grodzovsky
2026-06-18 20:15 ` [PATCH 6.12.y 09/27] scripts/sorttable: Add helper functions for Elf_Ehdr Andrey Grodzovsky
2026-06-18 20:15 ` [PATCH 6.12.y 10/27] scripts/sorttable: Add helper functions for Elf_Shdr Andrey Grodzovsky
2026-06-18 20:15 ` [PATCH 6.12.y 11/27] scripts/sorttable: Add helper functions for Elf_Sym Andrey Grodzovsky
2026-06-18 20:15 ` [PATCH 6.12.y 12/27] scripts/sorttable: Use uint64_t for mcount sorting Andrey Grodzovsky
2026-06-18 20:15 ` [PATCH 6.12.y 13/27] scripts/sorttable: Move code from sorttable.h into sorttable.c Andrey Grodzovsky
2026-06-18 20:15 ` [PATCH 6.12.y 14/27] scripts/sorttable: Get start/stop_mcount_loc from ELF file directly Andrey Grodzovsky
2026-06-18 20:15 ` [PATCH 6.12.y 15/27] scripts/sorttable: Use a structure of function pointers for elf helpers Andrey Grodzovsky
2026-06-18 20:15 ` [PATCH 6.12.y 16/27] arm64: scripts/sorttable: Implement sorting mcount_loc at boot for arm64 Andrey Grodzovsky
2026-06-18 20:15 ` [PATCH 6.12.y 17/27] scripts/sorttable: Have mcount rela sort use direct values Andrey Grodzovsky
2026-06-18 20:15 ` [PATCH 6.12.y 18/27] scripts/sorttable: Always use an array for the mcount_loc sorting Andrey Grodzovsky
2026-06-18 20:15 ` [PATCH 6.12.y 19/27] scripts/sorttable: Zero out weak functions in mcount_loc table Andrey Grodzovsky
2026-06-18 20:15 ` [PATCH 6.12.y 20/27] ftrace: Update the mcount_loc check of skipped entries Andrey Grodzovsky
2026-06-18 20:15 ` [PATCH 6.12.y 21/27] ftrace: Have ftrace pages output reflect freed pages Andrey Grodzovsky
2026-06-18 20:15 ` [PATCH 6.12.y 22/27] ftrace: Do not over-allocate ftrace memory Andrey Grodzovsky
2026-06-18 20:15 ` [PATCH 6.12.y 23/27] ftrace: Test mcount_loc addr before calling ftrace_call_addr() Andrey Grodzovsky
2026-06-18 20:15 ` [PATCH 6.12.y 24/27] ftrace: Check against is_kernel_text() instead of kaslr_offset() Andrey Grodzovsky
2026-06-18 20:15 ` [PATCH 6.12.y 25/27] scripts/sorttable: Use normal sort if theres no relocs in the mcount section Andrey Grodzovsky
2026-06-18 20:15 ` [PATCH 6.12.y 26/27] scripts/sorttable: Allow matches to functions before function entry Andrey Grodzovsky
2026-06-18 20:15 ` [PATCH 6.12.y 27/27] scripts/sorttable: Fix endianness handling in build-time mcount sort Andrey Grodzovsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox