mirror of
https://github.com/dynup/kpatch
synced 2025-01-11 23:59:24 +00:00
create-diff-object: allow dynamic debug static keys
While static keys (jump labels) are currently broken in livepatch, a broken dynamic debug static key is harmless since it just disables dynamically enabled debug printks in the patched code. Fixes: #1021 Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
This commit is contained in:
parent
1fe8fe66c2
commit
2975775768
@ -237,6 +237,15 @@ static void kpatch_detect_child_functions(struct kpatch_elf *kelf)
|
||||
}
|
||||
}
|
||||
|
||||
static bool is_dynamic_debug_symbol(struct symbol *sym)
|
||||
{
|
||||
if (sym->type == STT_OBJECT && !strcmp(sym->sec->name, "__verbose"))
|
||||
return true;
|
||||
if (sym->type == STT_SECTION && !strcmp(sym->name, "__verbose"))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* This function detects whether the given symbol is a "special" static local
|
||||
* variable (for lack of a better term).
|
||||
@ -261,8 +270,7 @@ static int is_special_static(struct symbol *sym)
|
||||
return 0;
|
||||
|
||||
/* pr_debug() uses static local variables in the __verbose section */
|
||||
if ((sym->type == STT_OBJECT && !strcmp(sym->sec->name, "__verbose")) ||
|
||||
(sym->type == STT_SECTION && !strcmp(sym->name, "__verbose")))
|
||||
if (is_dynamic_debug_symbol(sym))
|
||||
return 1;
|
||||
|
||||
if (sym->type == STT_SECTION) {
|
||||
@ -2104,9 +2112,16 @@ static void kpatch_regenerate_special_section(struct kpatch_elf *kelf,
|
||||
if (i != 3)
|
||||
ERROR("BUG: __jump_table has an unexpected format");
|
||||
|
||||
if (strncmp(key->sym->name, "__tracepoint_", 13))
|
||||
ERROR("Found a jump label at %s()+0x%x, using key %s. Jump labels aren't currently supported. Use static_key_enabled() instead.",
|
||||
code->sym->name, code->addend, key->sym->name);
|
||||
/* inert tracepoints are harmless */
|
||||
if (!strncmp(key->sym->name, "__tracepoint_", 13))
|
||||
continue;
|
||||
|
||||
/* inert dynamic debug printks are harmless */
|
||||
if (is_dynamic_debug_symbol(key->sym))
|
||||
continue;
|
||||
|
||||
ERROR("Found a jump label at %s()+0x%x, using key %s. Jump labels aren't currently supported. Use static_key_enabled() instead.",
|
||||
code->sym->name, code->addend, key->sym->name);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 0b34cbb7e835706615d2295f8c3129a23e19f6e6
|
||||
Subproject commit 510a90ca8d35c09574d449ea0f171a7a9baaf087
|
Loading…
Reference in New Issue
Block a user