Re: [PATCH v1 2/5] livepatch: Add klp-convert tool

From
Petr Mladek <pmladek@suse.com>
Date
2024-01-05 15:01:52
Also in
linux-kbuild, lkml
Reply to
Lukas Hruska, 2023-11-06
On Mon 2023-11-06 17:25:10, Lukas Hruska wrote:
quoted hunk ↗ jump to hunk
Livepatches need to access external symbols which can't be handled
by the normal relocation mechanism. It is needed for two types
of symbols:
--- /dev/null
+++ b/scripts/livepatch/klp-convert.c
@@ -0,0 +1,283 @@
[...]
quoted hunk ↗ jump to hunk
+/*
+ * Formats name of klp rela symbol based on another given section (@oldsec)
+ * and object (@obj_name) name, then returns it
+ */
+static char *alloc_klp_rela_name(struct section *oldsec,
+		char *target_objname, struct elf *klp_elf)
+{
Nit: Please, use @lp_obj_name instead of @target_objname.
     It would make it consistent with the caller:

	klp_rela_name = alloc_klp_rela_name(oldsec, lp_obj_name, klp_elf);

and also with

#define KLP_RELOC_SYMBOL_POS(LP_OBJ_NAME, SYM_OBJ_NAME, SYM_NAME, SYM_POS)

quoted hunk ↗ jump to hunk
+	char *klp_rela_name;
+	unsigned int length;
+	int err;
Just for record. The name "lp_obj_name" came from a discussion between
me and Lukas about the KLP_RELOC_SYMBOL_POS() parameter names.

The macro has two object name parameters. And LP_OBJ_NAME aka
LivePatched_OBJ_NAME looked better than TARGET_OBJ_NAME.
The name "TARGET" is too ambiguous to me.

Best Regards,
Petr
Thread (20 messages) 20 messages, 4 authors, last reply 2024-04-11
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help