]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
kallsyms/bpf: rename __bpf_address_lookup() to bpf_address_lookup()
authorPetr Mladek <pmladek@suse.com>
Fri, 28 Nov 2025 13:59:18 +0000 (14:59 +0100)
committerAndrew Morton <akpm@linux-foundation.org>
Wed, 21 Jan 2026 03:44:22 +0000 (19:44 -0800)
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>
arch/arm64/net/bpf_jit_comp.c
arch/loongarch/net/bpf_jit.c
arch/powerpc/net/bpf_jit_comp.c
include/linux/filter.h
kernel/bpf/core.c
kernel/kallsyms.c

index b6eb7a465ad248164db927bc8f0f2d01124e77da..1d657bd3ce655236c7193594282d9973326b2fa1 100644 (file)
@@ -2951,7 +2951,7 @@ int bpf_arch_text_poke(void *ip, enum bpf_text_poke_type old_t,
        u64 plt_target = 0ULL;
        bool poking_bpf_entry;
 
-       if (!__bpf_address_lookup((unsigned long)ip, &size, &offset, namebuf))
+       if (!bpf_address_lookup((unsigned long)ip, &size, &offset, namebuf))
                /* Only poking bpf text is supported. Since kernel function
                 * entry is set up by ftrace, we reply on ftrace to poke kernel
                 * functions.
index d1d5a65308b9eb2db571b77d50ea38be53151f25..3b63bc5b99d9a441c43d5c4e42841ef4f370e966 100644 (file)
@@ -1319,7 +1319,7 @@ int bpf_arch_text_poke(void *ip, enum bpf_text_poke_type old_t,
        /* Only poking bpf text is supported. Since kernel function entry
         * is set up by ftrace, we rely on ftrace to poke kernel functions.
         */
-       if (!__bpf_address_lookup((unsigned long)ip, &size, &offset, namebuf))
+       if (!bpf_address_lookup((unsigned long)ip, &size, &offset, namebuf))
                return -ENOTSUPP;
 
        image = ip - offset;
index 5e976730b2f5f51cfe87b3cef30860da30857ed4..e199976e410a192bbfcae0c558dd055ede7ea80f 100644 (file)
@@ -1122,7 +1122,7 @@ int bpf_arch_text_poke(void *ip, enum bpf_text_poke_type old_t,
        bpf_func = (unsigned long)ip;
 
        /* We currently only support poking bpf programs */
-       if (!__bpf_address_lookup(bpf_func, &size, &offset, name)) {
+       if (!bpf_address_lookup(bpf_func, &size, &offset, name)) {
                pr_err("%s (0x%lx): kernel/modules are not supported\n", __func__, bpf_func);
                return -EOPNOTSUPP;
        }
index fd54fed8f95f3b0e6ddeb436bc96b861c6d98972..7452817d707d19d3f15293e185014796f92336b2 100644 (file)
@@ -1375,24 +1375,13 @@ static inline bool bpf_jit_kallsyms_enabled(void)
        return false;
 }
 
-int __bpf_address_lookup(unsigned long addr, unsigned long *size,
-                                unsigned long *off, char *sym);
+int bpf_address_lookup(unsigned long addr, unsigned long *size,
+                      unsigned long *off, char *sym);
 bool is_bpf_text_address(unsigned long addr);
 int bpf_get_kallsym(unsigned int symnum, unsigned long *value, char *type,
                    char *sym);
 struct bpf_prog *bpf_prog_ksym_find(unsigned long addr);
 
-static inline int
-bpf_address_lookup(unsigned long addr, unsigned long *size,
-                  unsigned long *off, char **modname, char *sym)
-{
-       int ret = __bpf_address_lookup(addr, size, off, sym);
-
-       if (ret && modname)
-               *modname = NULL;
-       return ret;
-}
-
 void bpf_prog_kallsyms_add(struct bpf_prog *fp);
 void bpf_prog_kallsyms_del(struct bpf_prog *fp);
 
@@ -1431,8 +1420,8 @@ static inline bool bpf_jit_kallsyms_enabled(void)
 }
 
 static inline int
-__bpf_address_lookup(unsigned long addr, unsigned long *size,
-                    unsigned long *off, char *sym)
+bpf_address_lookup(unsigned long addr, unsigned long *size,
+                  unsigned long *off, char *sym)
 {
        return 0;
 }
@@ -1453,13 +1442,6 @@ static inline struct bpf_prog *bpf_prog_ksym_find(unsigned long addr)
        return NULL;
 }
 
-static inline int
-bpf_address_lookup(unsigned long addr, unsigned long *size,
-                  unsigned long *off, char **modname, char *sym)
-{
-       return 0;
-}
-
 static inline void bpf_prog_kallsyms_add(struct bpf_prog *fp)
 {
 }
index f1c5fc66ef01b633505bd41ab8fb0a172b56e576..8f6d8f1c4946479b685e1006d553c6c9dc81dfa7 100644 (file)
@@ -714,8 +714,8 @@ static struct bpf_ksym *bpf_ksym_find(unsigned long addr)
        return n ? container_of(n, struct bpf_ksym, tnode) : NULL;
 }
 
-int __bpf_address_lookup(unsigned long addr, unsigned long *size,
-                                unsigned long *off, char *sym)
+int bpf_address_lookup(unsigned long addr, unsigned long *size,
+                      unsigned long *off, char *sym)
 {
        struct bpf_ksym *ksym;
        int ret = 0;
index c0898327836c8d1e645587187a6a5f39efee571f..a37cafdf52cab5e691e4eb2382dafaecef20ce80 100644 (file)
@@ -345,7 +345,7 @@ int kallsyms_lookup_size_offset(unsigned long addr, unsigned long *symbolsize,
                return 1;
        }
        return !!module_address_lookup(addr, symbolsize, offset, NULL, NULL, namebuf) ||
-              !!__bpf_address_lookup(addr, symbolsize, offset, namebuf);
+              !!bpf_address_lookup(addr, symbolsize, offset, namebuf);
 }
 
 static int kallsyms_lookup_buildid(unsigned long addr,
@@ -386,8 +386,7 @@ static int kallsyms_lookup_buildid(unsigned long addr,
        ret = module_address_lookup(addr, symbolsize, offset,
                                    modname, modbuildid, namebuf);
        if (!ret)
-               ret = bpf_address_lookup(addr, symbolsize,
-                                        offset, modname, namebuf);
+               ret = bpf_address_lookup(addr, symbolsize, offset, namebuf);
 
        if (!ret)
                ret = ftrace_mod_address_lookup(addr, symbolsize,