Skip to content

Commit d9a0ee1

Browse files
pmladekKernel Patches Daemon
authored andcommitted
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 not longer needed. Both @modname and @modbuildid are newly 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. Fixes: 9294523 ("module: add printk formats to add module build ID to stacktraces") Signed-off-by: Petr Mladek <[email protected]>
1 parent 9d509a9 commit d9a0ee1

File tree

5 files changed

+10
-29
lines changed

5 files changed

+10
-29
lines changed

arch/arm64/net/bpf_jit_comp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2939,7 +2939,7 @@ int bpf_arch_text_poke(void *ip, enum bpf_text_poke_type poke_type,
29392939
u64 plt_target = 0ULL;
29402940
bool poking_bpf_entry;
29412941

2942-
if (!__bpf_address_lookup((unsigned long)ip, &size, &offset, namebuf))
2942+
if (!bpf_address_lookup((unsigned long)ip, &size, &offset, namebuf))
29432943
/* Only poking bpf text is supported. Since kernel function
29442944
* entry is set up by ftrace, we reply on ftrace to poke kernel
29452945
* functions.

arch/powerpc/net/bpf_jit_comp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1122,7 +1122,7 @@ int bpf_arch_text_poke(void *ip, enum bpf_text_poke_type poke_type,
11221122
branch_flags = poke_type == BPF_MOD_CALL ? BRANCH_SET_LINK : 0;
11231123

11241124
/* 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)) {
11261126
pr_err("%s (0x%lx): kernel/modules are not supported\n", __func__, bpf_func);
11271127
return -EOPNOTSUPP;
11281128
}

include/linux/filter.h

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1353,24 +1353,13 @@ static inline bool bpf_jit_kallsyms_enabled(void)
13531353
return false;
13541354
}
13551355

1356-
int __bpf_address_lookup(unsigned long addr, unsigned long *size,
1357-
unsigned long *off, char *sym);
1356+
int bpf_address_lookup(unsigned long addr, unsigned long *size,
1357+
unsigned long *off, char *sym);
13581358
bool is_bpf_text_address(unsigned long addr);
13591359
int bpf_get_kallsym(unsigned int symnum, unsigned long *value, char *type,
13601360
char *sym);
13611361
struct bpf_prog *bpf_prog_ksym_find(unsigned long addr);
13621362

1363-
static inline int
1364-
bpf_address_lookup(unsigned long addr, unsigned long *size,
1365-
unsigned long *off, char **modname, char *sym)
1366-
{
1367-
int ret = __bpf_address_lookup(addr, size, off, sym);
1368-
1369-
if (ret && modname)
1370-
*modname = NULL;
1371-
return ret;
1372-
}
1373-
13741363
void bpf_prog_kallsyms_add(struct bpf_prog *fp);
13751364
void bpf_prog_kallsyms_del(struct bpf_prog *fp);
13761365

@@ -1409,8 +1398,8 @@ static inline bool bpf_jit_kallsyms_enabled(void)
14091398
}
14101399

14111400
static inline int
1412-
__bpf_address_lookup(unsigned long addr, unsigned long *size,
1413-
unsigned long *off, char *sym)
1401+
bpf_address_lookup(unsigned long addr, unsigned long *size,
1402+
unsigned long *off, char *sym)
14141403
{
14151404
return 0;
14161405
}
@@ -1431,13 +1420,6 @@ static inline struct bpf_prog *bpf_prog_ksym_find(unsigned long addr)
14311420
return NULL;
14321421
}
14331422

1434-
static inline int
1435-
bpf_address_lookup(unsigned long addr, unsigned long *size,
1436-
unsigned long *off, char **modname, char *sym)
1437-
{
1438-
return 0;
1439-
}
1440-
14411423
static inline void bpf_prog_kallsyms_add(struct bpf_prog *fp)
14421424
{
14431425
}

kernel/bpf/core.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -713,8 +713,8 @@ static struct bpf_ksym *bpf_ksym_find(unsigned long addr)
713713
return n ? container_of(n, struct bpf_ksym, tnode) : NULL;
714714
}
715715

716-
int __bpf_address_lookup(unsigned long addr, unsigned long *size,
717-
unsigned long *off, char *sym)
716+
int bpf_address_lookup(unsigned long addr, unsigned long *size,
717+
unsigned long *off, char *sym)
718718
{
719719
struct bpf_ksym *ksym;
720720
int ret = 0;

kernel/kallsyms.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ int kallsyms_lookup_size_offset(unsigned long addr, unsigned long *symbolsize,
342342
return 1;
343343
}
344344
return !!module_address_lookup(addr, symbolsize, offset, NULL, NULL, namebuf) ||
345-
!!__bpf_address_lookup(addr, symbolsize, offset, namebuf);
345+
!!bpf_address_lookup(addr, symbolsize, offset, namebuf);
346346
}
347347

348348
static int kallsyms_lookup_buildid(unsigned long addr,
@@ -383,8 +383,7 @@ static int kallsyms_lookup_buildid(unsigned long addr,
383383
ret = module_address_lookup(addr, symbolsize, offset,
384384
modname, modbuildid, namebuf);
385385
if (!ret)
386-
ret = bpf_address_lookup(addr, symbolsize,
387-
offset, modname, namebuf);
386+
ret = bpf_address_lookup(addr, symbolsize, offset, namebuf);
388387

389388
if (!ret)
390389
ret = ftrace_mod_address_lookup(addr, symbolsize,

0 commit comments

Comments
 (0)