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.

kallsyms/bpf: rename __bpf_address_lookup() to bpf_address_lookup()

bpf_address_lookup() has been used only in kallsyms_lookup_buildid(). It
was supposed to set @modname and @modbuildid when the symbol was in a
module.

But it always just cleared @modname because BPF symbols were never in a
module. And it did not clear @modbuildid because the pointer was not
passed.

The wrapper is no longer needed. Both @modname and @modbuildid are now
always initialized to NULL in kallsyms_lookup_buildid().

Remove the wrapper and rename __bpf_address_lookup() to
bpf_address_lookup() because this variant is used everywhere.

[akpm@linux-foundation.org: fix loongarch]
Link: https://lkml.kernel.org/r/20251128135920.217303-6-pmladek@suse.com
Fixes: 9294523e3768 ("module: add printk formats to add module build ID to stacktraces")
Signed-off-by: Petr Mladek <pmladek@suse.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Cc: Aaron Tomlin <atomlin@atomlin.com>
Cc: Daniel Borkman <daniel@iogearbox.net>
Cc: Daniel Gomez <da.gomez@samsung.com>
Cc: John Fastabend <john.fastabend@gmail.com>
Cc: Kees Cook <kees@kernel.org>
Cc: Luis Chamberalin <mcgrof@kernel.org>
Cc: Marc Rutland <mark.rutland@arm.com>
Cc: "Masami Hiramatsu (Google)" <mhiramat@kernel.org>
Cc: Petr Pavlu <petr.pavlu@suse.com>
Cc: Sami Tolvanen <samitolvanen@google.com>
Cc: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Petr Mladek and committed by
Andrew Morton
cd673589 8e81dac4

+11 -30
+1 -1
arch/arm64/net/bpf_jit_comp.c
··· 2951 2951 u64 plt_target = 0ULL; 2952 2952 bool poking_bpf_entry; 2953 2953 2954 - if (!__bpf_address_lookup((unsigned long)ip, &size, &offset, namebuf)) 2954 + if (!bpf_address_lookup((unsigned long)ip, &size, &offset, namebuf)) 2955 2955 /* Only poking bpf text is supported. Since kernel function 2956 2956 * entry is set up by ftrace, we reply on ftrace to poke kernel 2957 2957 * functions.
+1 -1
arch/loongarch/net/bpf_jit.c
··· 1319 1319 /* Only poking bpf text is supported. Since kernel function entry 1320 1320 * is set up by ftrace, we rely on ftrace to poke kernel functions. 1321 1321 */ 1322 - if (!__bpf_address_lookup((unsigned long)ip, &size, &offset, namebuf)) 1322 + if (!bpf_address_lookup((unsigned long)ip, &size, &offset, namebuf)) 1323 1323 return -ENOTSUPP; 1324 1324 1325 1325 image = ip - offset;
+1 -1
arch/powerpc/net/bpf_jit_comp.c
··· 1122 1122 bpf_func = (unsigned long)ip; 1123 1123 1124 1124 /* We currently only support poking bpf programs */ 1125 - if (!__bpf_address_lookup(bpf_func, &size, &offset, name)) { 1125 + if (!bpf_address_lookup(bpf_func, &size, &offset, name)) { 1126 1126 pr_err("%s (0x%lx): kernel/modules are not supported\n", __func__, bpf_func); 1127 1127 return -EOPNOTSUPP; 1128 1128 }
+4 -22
include/linux/filter.h
··· 1375 1375 return false; 1376 1376 } 1377 1377 1378 - int __bpf_address_lookup(unsigned long addr, unsigned long *size, 1379 - unsigned long *off, char *sym); 1378 + int bpf_address_lookup(unsigned long addr, unsigned long *size, 1379 + unsigned long *off, char *sym); 1380 1380 bool is_bpf_text_address(unsigned long addr); 1381 1381 int bpf_get_kallsym(unsigned int symnum, unsigned long *value, char *type, 1382 1382 char *sym); 1383 1383 struct bpf_prog *bpf_prog_ksym_find(unsigned long addr); 1384 - 1385 - static inline int 1386 - bpf_address_lookup(unsigned long addr, unsigned long *size, 1387 - unsigned long *off, char **modname, char *sym) 1388 - { 1389 - int ret = __bpf_address_lookup(addr, size, off, sym); 1390 - 1391 - if (ret && modname) 1392 - *modname = NULL; 1393 - return ret; 1394 - } 1395 1384 1396 1385 void bpf_prog_kallsyms_add(struct bpf_prog *fp); 1397 1386 void bpf_prog_kallsyms_del(struct bpf_prog *fp); ··· 1420 1431 } 1421 1432 1422 1433 static inline int 1423 - __bpf_address_lookup(unsigned long addr, unsigned long *size, 1424 - unsigned long *off, char *sym) 1434 + bpf_address_lookup(unsigned long addr, unsigned long *size, 1435 + unsigned long *off, char *sym) 1425 1436 { 1426 1437 return 0; 1427 1438 } ··· 1440 1451 static inline struct bpf_prog *bpf_prog_ksym_find(unsigned long addr) 1441 1452 { 1442 1453 return NULL; 1443 - } 1444 - 1445 - static inline int 1446 - bpf_address_lookup(unsigned long addr, unsigned long *size, 1447 - unsigned long *off, char **modname, char *sym) 1448 - { 1449 - return 0; 1450 1454 } 1451 1455 1452 1456 static inline void bpf_prog_kallsyms_add(struct bpf_prog *fp)
+2 -2
kernel/bpf/core.c
··· 714 714 return n ? container_of(n, struct bpf_ksym, tnode) : NULL; 715 715 } 716 716 717 - int __bpf_address_lookup(unsigned long addr, unsigned long *size, 718 - unsigned long *off, char *sym) 717 + int bpf_address_lookup(unsigned long addr, unsigned long *size, 718 + unsigned long *off, char *sym) 719 719 { 720 720 struct bpf_ksym *ksym; 721 721 int ret = 0;
+2 -3
kernel/kallsyms.c
··· 345 345 return 1; 346 346 } 347 347 return !!module_address_lookup(addr, symbolsize, offset, NULL, NULL, namebuf) || 348 - !!__bpf_address_lookup(addr, symbolsize, offset, namebuf); 348 + !!bpf_address_lookup(addr, symbolsize, offset, namebuf); 349 349 } 350 350 351 351 static int kallsyms_lookup_buildid(unsigned long addr, ··· 386 386 ret = module_address_lookup(addr, symbolsize, offset, 387 387 modname, modbuildid, namebuf); 388 388 if (!ret) 389 - ret = bpf_address_lookup(addr, symbolsize, 390 - offset, modname, namebuf); 389 + ret = bpf_address_lookup(addr, symbolsize, offset, namebuf); 391 390 392 391 if (!ret) 393 392 ret = ftrace_mod_address_lookup(addr, symbolsize,