[Devel] [PATCH hci-8.2 13/17] ms/objtool/klp: Fix pointer comparisons for rodata objects

Konstantin Khorenko khorenko at virtuozzo.com
Tue Nov 24 15:20:23 MSK 2026


I won't apply this version, please send v2 with the changes below.

On Tue, 24 Nov 2026 07:01:02 +0200, Eva Kurchatova wrote:
> Fix it by correlating non-anonymous rodata objects.

Item 1 of the cover letter reply: a vz patch after this one that fails
klp diff when a correlated .rodata object differs in length, bytes or
relocations, or drop this patch.

The pick matches mainline, but here it brings a new silently wrong
case. Before it, a reference to a static const table from a changed
function cloned the patched .rodata object into the livepatch. Now
convert_reloc_sym() turns it into a reference to the object symbol,
klp_reloc_needed() returns true for a correlated unexported symbol,
and the livepatched function reads the original object.
mark_changed_functions() compares only function checksums, so a
changed object is not noticed.

Example: a fix adds a row to a static const table (an nla_policy, a
file_operations) and changes f() to use it. klp-build succeeds, and
the patched f() works on the old table, or reads past its end when it
loops to ARRAY_SIZE(). The same check also catches the other case
here: same-named function-local static const objects (tbl.1, tbl.2)
are correlated by name in order, so adding one earlier in the file
binds the reloc to another function's table.

In mainline this commit came in v7.2-rc1 together with 6016dd33a10a
("objtool/klp: Rewrite symbol correlation algorithm"), which rejects
such a patch; that rewrite is too large to take here, a small check
after correlate_symbols() is enough.

-- 
Konstantin Khorenko,
Virtuozzo Linux Kernel Team



More information about the Devel mailing list