From 7b367a4ef5f5a9b6f801fe5fbc0e5616c53a7c9f Mon Sep 17 00:00:00 2001 From: Josh Poimboeuf Date: Fri, 5 Jul 2019 15:28:53 -0500 Subject: [PATCH] create-diff-object: Support dynamic debug on newer kernels After Linux commit 47cdd64be483 ("dynamic_debug: refactor dynamic_pr_debug and friends"), the name of the static local variable used for dynamic printks is no longer "descriptor". Make the is_special_static() check broader such that it doesn't care about the variable name, and just whitelists any variable in the __verbose section. Fixes #990. Signed-off-by: Josh Poimboeuf --- kpatch-build/create-diff-object.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/kpatch-build/create-diff-object.c b/kpatch-build/create-diff-object.c index 3b366fe..6bf2b17 100644 --- a/kpatch-build/create-diff-object.c +++ b/kpatch-build/create-diff-object.c @@ -249,7 +249,6 @@ static int is_special_static(struct symbol *sym) static char *prefixes[] = { "__key.", "__warned.", - "descriptor.", "__func__.", "__FUNCTION__.", "_rs.", @@ -261,12 +260,13 @@ static int is_special_static(struct symbol *sym) if (!sym) return 0; - if (sym->type == STT_SECTION) { - /* __verbose section contains the descriptor variables */ - if (!strcmp(sym->name, "__verbose")) - return 1; + /* 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"))) + return 1; - /* otherwise make sure section is bundled */ + if (sym->type == STT_SECTION) { + /* make sure section is bundled */ if (!sym->sec->sym) return 0; @@ -1117,8 +1117,8 @@ static void kpatch_correlate_static_local_variables(struct kpatch_elf *base, if (bundled != patched_bundled) ERROR("bundle mismatch for symbol %s", sym->name); if (!bundled && sym->sec->twin != patched_sym->sec) - ERROR("sections %s and %s aren't correlated", - sym->sec->name, patched_sym->sec->name); + ERROR("sections %s and %s aren't correlated for symbol %s", + sym->sec->name, patched_sym->sec->name, sym->name); log_debug("renaming and correlating static local %s to %s\n", patched_sym->name, sym->name);