]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
objtool/klp: Don't correlate .rodata.cst* constant pool objects
authorJosh Poimboeuf <jpoimboe@kernel.org>
Thu, 30 Apr 2026 00:35:48 +0000 (17:35 -0700)
committerJosh Poimboeuf <jpoimboe@kernel.org>
Tue, 5 May 2026 04:16:02 +0000 (21:16 -0700)
commit51e1dfce24c8f4b1cdfa614a43ee195088901eca
tree79ceddfce7cfe45aa16487c2bf2425a4ece9f0d1
parentd5b0f025281f287759820f57b7ba1bac7827b338
objtool/klp: Don't correlate .rodata.cst* constant pool objects

Clang aggregates UBSAN type descriptors into shared anonymous
.data..L__unnamed_* sections.  This data is used by UBSAN trap handlers.

When a changed function has an UBSAN bounds check, klp-diff clones the
entire UBSAN data section associated with the TU.  Relocations within
the cloned section that reference named rodata objects in .rodata.cst*
(like 'exponent', 'pirq_ali_set.irqmap') become KLP relocations because
those objects now get correlated.

That results in a .klp.rela.vmlinux..data section which can easily have
thousands of KLP relocs, most of which are completely superfluous, used
by functions which aren't cloned to the patch module.

The .rodata.cst* sections are SHF_MERGE constant pool sections
containing small fixed-size data (lookup tables, bitmasks) that is only
read by value.  Pointer identity is never relevant for these objects, so
correlating them is unnecessary.

Exclude .rodata.cst* objects from correlation so they get cloned as
local data instead of generating KLP relocations.

It might be possible to someday treat UBSAN data sections as special
sections, and only extract the few needed entries.  But this works for
now.

Acked-by: Song Liu <song@kernel.org>
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
tools/objtool/klp-diff.c