Skip to content

Commit e476bb2

Browse files
committed
objtool/klp: Disable unsupported pr_debug() usage
Instead of erroring out on unsupported pr_debug() (e.g., when patching a module), issue a warning and make it inert, similar to how unsupported tracepoints are currently handled. Reviewed-and-tested-by: Song Liu <song@kernel.org> Link: https://patch.msgid.link/3a7db3a5b7d4abf9b2534803a74e2e7231322738.1770759954.git.jpoimboe@kernel.org Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
1 parent f9fb44b commit e476bb2

1 file changed

Lines changed: 15 additions & 8 deletions

File tree

tools/objtool/klp-diff.c

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1334,18 +1334,18 @@ static bool should_keep_special_sym(struct elf *elf, struct symbol *sym)
13341334
* be applied after static branch/call init, resulting in code corruption.
13351335
*
13361336
* Validate a special section entry to avoid that. Note that an inert
1337-
* tracepoint is harmless enough, in that case just skip the entry and print a
1338-
* warning. Otherwise, return an error.
1337+
* tracepoint or pr_debug() is harmless enough, in that case just skip the
1338+
* entry and print a warning. Otherwise, return an error.
13391339
*
1340-
* This is only a temporary limitation which will be fixed when livepatch adds
1341-
* support for submodules: fully self-contained modules which are embedded in
1342-
* the top-level livepatch module's data and which can be loaded on demand when
1343-
* their corresponding to-be-patched module gets loaded. Then klp relocs can
1344-
* be retired.
1340+
* TODO: This is only a temporary limitation which will be fixed when livepatch
1341+
* adds support for submodules: fully self-contained modules which are embedded
1342+
* in the top-level livepatch module's data and which can be loaded on demand
1343+
* when their corresponding to-be-patched module gets loaded. Then klp relocs
1344+
* can be retired.
13451345
*
13461346
* Return:
13471347
* -1: error: validation failed
1348-
* 1: warning: tracepoint skipped
1348+
* 1: warning: disabled tracepoint or pr_debug()
13491349
* 0: success
13501350
*/
13511351
static int validate_special_section_klp_reloc(struct elfs *e, struct symbol *sym)
@@ -1403,6 +1403,13 @@ static int validate_special_section_klp_reloc(struct elfs *e, struct symbol *sym
14031403
continue;
14041404
}
14051405

1406+
if (strstr(reloc->sym->name, "__UNIQUE_ID_ddebug_")) {
1407+
WARN("%s: disabling unsupported pr_debug()",
1408+
code_sym->name);
1409+
ret = 1;
1410+
continue;
1411+
}
1412+
14061413
ERROR("%s+0x%lx: unsupported static branch key %s. Use static_key_enabled() instead",
14071414
code_sym->name, code_offset, reloc->sym->name);
14081415
return -1;

0 commit comments

Comments
 (0)