Skip to contentSkip to conversation

FAILED: patch "[PATCH] perf auxtrace: Fix address filter symbol name match for" failed to apply to 4.9-stable tree

PATCH [email protected] 1 participant 1 message Oct 31, 2022

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 4.9-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

Possible dependencies:

cba04f3136b6 ("perf auxtrace: Fix address filter symbol name match for modules") e85e0e0ccc60 ("perf tools: Use kallsyms__is_function()")

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From cba04f3136b658583adb191556f99d087589c1cc Mon Sep 17 00:00:00 2001
From: Adrian Hunter <[email protected]>
Date: Wed, 26 Oct 2022 10:27:36 +0300
Subject: [PATCH] perf auxtrace: Fix address filter symbol name match for
modules

For modules, names from kallsyms__parse() contain the module name which meant that module symbols did not match exactly by name.

Fix by matching the name string up to the separating tab character.

Fixes 1b36c03e356936d6 ("perf record: Add support for using symbols in address filters")
Cc Adrian Hunter <[email protected]>
Cc Ian Rogers <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Namhyung Kim <[email protected]>
tools/perf/util/auxtrace.c +9 -1
index 60d8beb662aa..46ada5ec3f9a 100644
@@ -2325,11 +2325,19 @@ struct sym_args {
 	bool		near;
 };
 
+static bool kern_sym_name_match(const char *kname, const char *name)
+{
+	size_t n = strlen(name);
+
+	return !strcmp(kname, name) ||
+	       (!strncmp(kname, name, n) && kname[n] == '\t');
+}
+
 static bool kern_sym_match(struct sym_args *args, const char *name, char type)
 {
 	/* A function with the same name, and global or the n'th found or any */
 	return kallsyms__is_function(type) &&
-	       !strcmp(name, args->name) &&
+	       kern_sym_name_match(name, args->name) &&
 	       ((args->global && isupper(type)) ||
 		(args->selected && ++(args->cnt) == args->idx) ||
 		(!args->global && !args->selected));