[Devel] [PATCH hci-8.2 v2 13/18] ms/objtool/klp: Fix pointer comparisons for rodata objects
Konstantin Khorenko
khorenko at virtuozzo.com
Wed Nov 25 13:35:23 MSK 2026
I won't apply this version, please send v3 with the changes below.
- A reference to a size-less global label in .rodata must keep using
the section symbol, or fail klp diff: item 1 of the cover letter
reply.
On Wed, 25 Nov 2026 08:03:55 +0200, Eva Kurchatova wrote:
> - strstarts(sec->name, ".rodata") ||
> strstarts(sec->name, ".data..Lubsan") || /* GCC */
Some asm puts global labels without a size into .rodata:
uretprobe_trampoline_entry/_end, optprobe_template_*,
skl_call_thunk_template/_tail, kernel_config_data/_end. After this patch
a changed function's reference to such a label keeps the label symbol;
dont_correlate() is true for it, so there is no klp reloc, and the
label is cloned with data_too but length 0, so no bytes are copied. A
start/end pair then lands on one address at the end of the module's
.rodata, and a livepatch of arch_uprobe_trampoline() builds and runs on
garbage. Before this patch the whole section was cloned. Patch 14 does
not catch it: it checks STT_OBJECT only.
Converting such references to the section symbol, as before, would do:
if (is_uncorrelated_section(sec) ||
(is_rodata_sec(sec) && !is_sec_sym(reloc->sym) &&
!is_object_sym(reloc->sym)))
return convert_reloc_sym_to_secsym(elf, reloc);
--
Konstantin Khorenko,
Virtuozzo Linux Kernel Team
More information about the Devel
mailing list