[Devel] [PATCH hci-8.2 v2 14/18] objtool/klp: Reject changed .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.
- Also check a pair whose patched side is in .rodata: item 2.
- Do not compare the addend of an anonymous target: item 3.
- Lowercase subject: item 4 of the cover letter reply.
On Wed, 25 Nov 2026 08:03:56 +0200, Eva Kurchatova wrote:
> Subject: [PATCH hci-8.2 v2 14/18] objtool/klp: Reject changed .rodata objects
Item 4: a vz commit, so "objtool/klp: reject changed .rodata objects".
> + for_each_sym(e->orig, orig) {
> + if (!is_object_sym(orig) || !is_rodata_sec(orig->sec) || !orig->twin)
> + continue;
Item 2: a fix that turns a writable table into a const one with new
contents correlates the two by name; the patched code gets a klp reloc
to the old writable object, and this loop skips the pair because the
original is not in .rodata. Before patch 13 the new contents were
cloned. Check the pair when either side is in .rodata; for a .bss
original sym_data() is NULL, so the memcmp() in object_changed() needs
the same guard as in reloc_changed().
> + if (!orig_sym || !patched_sym)
> + return orig_sym != patched_sym ||
> + strcmp(orig->sym->sec->name, patched->sym->sec->name) ||
> + arch_adjusted_addend(orig) != arch_adjusted_addend(patched);
Item 3: klp diff runs on the whole vmlinux.o, an ld -r link in which
the plain .rodata of all files is one section, and anonymous constants
(strings with an embedded NUL, constant pool data) stay there even with
-fdata-sections. A patch that adds or resizes one such constant in
kernel/sys.c moves every later anonymous constant, and the crypto
testmgr vector tables, which point at hundreds of them, then fail with
"changed data" although they did not change. Mainline skips such
targets in its checksum; compare the section name only, and fix the
last sentence of the message to match.
--
Konstantin Khorenko,
Virtuozzo Linux Kernel Team
More information about the Devel
mailing list