Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

+15 -8
+15 -8
tools/objtool/klp-diff.c
··· 1334 1334 * be applied after static branch/call init, resulting in code corruption. 1335 1335 * 1336 1336 * 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. 1339 1339 * 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. 1345 1345 * 1346 1346 * Return: 1347 1347 * -1: error: validation failed 1348 - * 1: warning: tracepoint skipped 1348 + * 1: warning: disabled tracepoint or pr_debug() 1349 1349 * 0: success 1350 1350 */ 1351 1351 static int validate_special_section_klp_reloc(struct elfs *e, struct symbol *sym) ··· 1399 1399 if (strstarts(reloc->sym->name, "__tracepoint_")) { 1400 1400 WARN("%s: disabling unsupported tracepoint %s", 1401 1401 code_sym->name, reloc->sym->name + 13); 1402 + ret = 1; 1403 + continue; 1404 + } 1405 + 1406 + if (strstr(reloc->sym->name, "__UNIQUE_ID_ddebug_")) { 1407 + WARN("%s: disabling unsupported pr_debug()", 1408 + code_sym->name); 1402 1409 ret = 1; 1403 1410 continue; 1404 1411 }