13–15 Nov 2023
America/New_York timezone

Kbuild support for klp-relocation generation

15 Nov 2023, 10:30
30m
"James River Salon B" (Omni Richmond Hotel)

"James River Salon B"

Omni Richmond Hotel

83
Live Patching MC Live Patching MC

Speaker

Lukáš Hruška

Description

Livepatches may use symbols which are not contained in its own scope, and, because of that, may end up compiled with relocations that will only be resolved during module load. Yet, when the referenced symbols are not exported, solving this relocation requires information on the object that holds the symbol (either vmlinux or modules) and its position inside the object, as an object may contain multiple symbols with the same name. Providing such information must be done according to what is specified in Documentation/livepatch/module-elf-format.txt.

Currently, there is no trivial way to embed the required information as requested in the final livepatch elf object. A proposed version [1] of klp-version submitted by Joe Lawrence solves this problem in two different forms: (i) by relying on a symbol map, which is built during kernel compilation, to automatically infer the relocation targeted symbol, and, when such inference is not possible (ii) by using annotations in the elf object to convert the relocation accordingly to the specification, enabling it to be handled by the livepatch loader.

After further discussion we got to the point there's currently no means whatsoever to create the symbol map and Nicolai Stange proposed resorting to a more minimal utility doing only the (ii) part. This minimalistic klp-convert would have no knowledge of the symbols available in the livepatched target objects at all and would simply rely only on symbols requiring the relocation having specific prefix by using predefined macro.

Currently there already exists first version of this minimalistic klp-convert, which is being tested and the patch will be submitted to the LP mailing list soon.

Now there is still a big question about upstreamability of this tool and also which approach sounds better to the community.

[1] https://lore.kernel.org/live-patching/20230314202356.kal22jracaw5442y@daedalus/T/#mc1028d2e6eb1c6b7ee1891025cc4913075d4332c

Primary author

Presentation materials

Diamond Sponsors
Platinum Sponsor
Gold Sponsors
Silver Sponsors
Catchbox Sponsor
Livestream Sponsors
T-Shirt Sponsor
Conference Services Provided by