Skip to contentSkip to conversation

kallsyms-ftrace-set-module-buildid-in-ftrace_mod_address_lookup.patch removed from -mm tree

merged mm-nonmm-stable Andrew Morton 1 participant 1 message Jan 21

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: kallsyms/ftrace: set module buildid in ftrace_mod_address_lookup()
has been removed from the -mm tree. Its filename was
kallsyms-ftrace-set-module-buildid-in-ftrace_mod_address_lookup.patch

This patch was dropped because it was merged into the mm-nonmm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Petr Mladek <[email protected]>
Subject: kallsyms/ftrace: set module buildid in ftrace_mod_address_lookup()
Date: Fri, 28 Nov 2025 14:59:19 +0100

__sprint_symbol() might access an invalid pointer when kallsyms_lookup_buildid() returns a symbol found by ftrace_mod_address_lookup().

The ftrace lookup function must set both @modname and @modbuildid the same way as module_address_lookup().

Fixes 9294523e3768 ("module: add printk formats to add module build ID to stacktraces")
Cc Alexei Starovoitov <[email protected]>
Cc Daniel Borkman <[email protected]>
Cc Daniel Gomez <[email protected]>
Cc John Fastabend <[email protected]>
Cc Kees Cook <[email protected]>
Cc Luis Chamberalin <[email protected]>
Cc Marc Rutland <[email protected]>
Cc "Masami Hiramatsu (Google)" <[email protected]>
Cc Petr Pavlu <[email protected]>
Cc Sami Tolvanen <[email protected]>

---

 include/linux/ftrace.h |    6 ++++--
 kernel/kallsyms.c      |    4 ++--
 kernel/trace/ftrace.c  |    5 ++++-
 3 files changed, 10 insertions(+), 5 deletions(-)
include/linux/ftrace.h renamed from include/linux/ftrace.h~kallsyms-ftrace-set-module-buildid-in-ftrace_mod_address_lookup +4 -2
@@ -87,11 +87,13 @@ struct ftrace_hash;
 	defined(CONFIG_DYNAMIC_FTRACE)
 int
 ftrace_mod_address_lookup(unsigned long addr, unsigned long *size,
-		   unsigned long *off, char **modname, char *sym);
+			  unsigned long *off, char **modname,
+			  const unsigned char **modbuildid, char *sym);
 #else
 static inline int
 ftrace_mod_address_lookup(unsigned long addr, unsigned long *size,
-		   unsigned long *off, char **modname, char *sym)
+			  unsigned long *off, char **modname,
+			  const unsigned char **modbuildid, char *sym)
 {
 	return 0;
 }
kernel/kallsyms.c renamed from kernel/kallsyms.c~kallsyms-ftrace-set-module-buildid-in-ftrace_mod_address_lookup +2 -2
@@ -389,8 +389,8 @@ static int kallsyms_lookup_buildid(unsig
 		ret = bpf_address_lookup(addr, symbolsize, offset, namebuf);
 
 	if (!ret)
-		ret = ftrace_mod_address_lookup(addr, symbolsize,
-						offset, modname, namebuf);
+		ret = ftrace_mod_address_lookup(addr, symbolsize, offset,
+						modname, modbuildid, namebuf);
 
 	return ret;
 }
kernel/trace/ftrace.c renamed from kernel/trace/ftrace.c~kallsyms-ftrace-set-module-buildid-in-ftrace_mod_address_lookup +4 -1
@@ -7753,7 +7753,8 @@ ftrace_func_address_lookup(struct ftrace
 
 int
 ftrace_mod_address_lookup(unsigned long addr, unsigned long *size,
-		   unsigned long *off, char **modname, char *sym)
+			  unsigned long *off, char **modname,
+			  const unsigned char **modbuildid, char *sym)
 {
 	struct ftrace_mod_map *mod_map;
 	int ret = 0;
@@ -7765,6 +7766,8 @@ ftrace_mod_address_lookup(unsigned long
 		if (ret) {
 			if (modname)
 				*modname = mod_map->mod->name;
+			if (modbuildid)
+				*modbuildid = module_buildid(mod_map->mod);
 			break;
 		}
 	}

_

Patches currently in -mm which might be from [email protected] are