From nobody Mon Dec 1 22:37:08 2025 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 15DED1C68F for ; Fri, 28 Nov 2025 14:00:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764338427; cv=none; b=CFvSzXQfuLfLZweLWoLgB6QwyUSPafuwmXMUU61GCMCITBHpEcGdZyJmjDeulL5YQ1Z1e3TdKcjI9QbMkwYFQPXc/zy7yLlXLTjwy4CetEigasbGx98Ynott1wgX9k8RuWNvzaMhcpeGIPSLAV3dWjvrdJDg12+qo3ktPMxKET0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764338427; c=relaxed/simple; bh=TQ44JRCm9Z7EU5hhvTiV5kNg21I4fO8mMdgiQbpQehI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OnaffGj9QyqUJieqParMtxYlmKF1bwn4nQ5ZTPIxXUYBc6UtlQLEOkrpUWvUYmpg6yYT5+2+eG7a0YubfMXnBG/MCgoldwSDB6/q5Z3NKIbaz96r2q3Y5oC+goViwLuxtZH5J8t5h9z+sSNR2KVz8ZnXxmkrrLiM29av7ADlBdw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b=CFx9ZZnj; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b=CFx9ZZnj; arc=none smtp.client-ip=195.135.223.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="CFx9ZZnj"; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="CFx9ZZnj" Received: from pathway.suse.cz (unknown [IPv6:2a07:de40:b2bf:1b::12bd]) by smtp-out2.suse.de (Postfix) with ESMTP id 2571E5BE39; Fri, 28 Nov 2025 14:00:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1764338424; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=33dceX869Yxv+fMp/noNAMlIUoMuEUQYg/YIhCE5Vhs=; b=CFx9ZZnjDUv+TRREegkr3iCHrRHPxBpja+l2HlevKMore3/oOCwMMInxlArFI2vxVKteh+ EfyP5BJzZb/JTAt2dFkCgw2jeR6rReurovP2y+qomhIjIdWS51Pw0b1jYuA+d2lMHNQjBT 6P5ekh98BgoLohs0fpzKPRyPvTTmjAY= Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.com header.s=susede1 header.b=CFx9ZZnj DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1764338424; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=33dceX869Yxv+fMp/noNAMlIUoMuEUQYg/YIhCE5Vhs=; b=CFx9ZZnjDUv+TRREegkr3iCHrRHPxBpja+l2HlevKMore3/oOCwMMInxlArFI2vxVKteh+ EfyP5BJzZb/JTAt2dFkCgw2jeR6rReurovP2y+qomhIjIdWS51Pw0b1jYuA+d2lMHNQjBT 6P5ekh98BgoLohs0fpzKPRyPvTTmjAY= From: Petr Mladek To: Petr Pavlu , Steven Rostedt , Alexei Starovoitov , Andrew Morton , Kees Cook Cc: Aaron Tomlin , Daniel Borkmann , John Fastabend , Masami Hiramatsu , Mark Rutland , Luis Chamberlain , Daniel Gomez , Sami Tolvanen , linux-kernel@vger.kernel.org, bpf@vger.kernel.org, linux-modules@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Petr Mladek Subject: [PATCH v3 5/7] kallsyms/bpf: Rename __bpf_address_lookup() to bpf_address_lookup() Date: Fri, 28 Nov 2025 14:59:18 +0100 Message-ID: <20251128135920.217303-6-pmladek@suse.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251128135920.217303-1-pmladek@suse.com> References: <20251128135920.217303-1-pmladek@suse.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [15.11 / 50.00]; SPAM_FLAG(5.00)[]; NEURAL_SPAM_LONG(3.50)[1.000]; BAYES_HAM(-3.00)[100.00%]; HFILTER_HOSTNAME_UNKNOWN(2.50)[]; RDNS_NONE(2.00)[]; SUSPICIOUS_RECIPS(1.50)[]; ONCE_RECEIVED(1.20)[]; HFILTER_HELO_IP_A(1.00)[pathway.suse.cz]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; HFILTER_HELO_NORES_A_OR_MX(0.30)[pathway.suse.cz]; R_DKIM_ALLOW(-0.20)[suse.com:s=susede1]; MIME_GOOD(-0.10)[text/plain]; NEURAL_HAM_SHORT(-0.08)[-0.394]; MX_GOOD(-0.01)[]; ARC_NA(0.00)[]; DIRECT_TO_MX(0.00)[git-send-email 2.52.0]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FROM_HAS_DN(0.00)[]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; RCPT_COUNT_TWELVE(0.00)[18]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCVD_COUNT_ZERO(0.00)[0]; TAGGED_RCPT(0.00)[]; FREEMAIL_CC(0.00)[atomlin.com,iogearbox.net,gmail.com,kernel.org,arm.com,google.com,vger.kernel.org,suse.com]; DKIM_TRACE(0.00)[suse.com:+]; R_RATELIMIT(0.00)[to_ip_from(RL6jpahug3dm5x93mmnjuwit91)]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.com:mid,suse.com:dkim,suse.com:email,pathway.suse.cz:helo]; TO_DN_SOME(0.00)[]; DNSWL_BLOCKED(0.00)[2a07:de40:b2bf:1b::12bd:from]; SPAMHAUS_XBL(0.00)[2a07:de40:b2bf:1b::12bd:from]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com] X-Spamd-Bar: +++++++++++++++ X-Rspamd-Queue-Id: 2571E5BE39 X-Spam-Flag: YES X-Spam-Score: 15.11 X-Spam-Level: *************** X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Action: add header X-Spam: Yes Content-Type: text/plain; charset="utf-8" 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. Fixes: 9294523e3768 ("module: add printk formats to add module build ID to = stacktraces") Acked-by: Alexei Starovoitov Signed-off-by: Petr Mladek --- arch/arm64/net/bpf_jit_comp.c | 2 +- arch/powerpc/net/bpf_jit_comp.c | 2 +- include/linux/filter.h | 26 ++++---------------------- kernel/bpf/core.c | 4 ++-- kernel/kallsyms.c | 5 ++--- 5 files changed, 10 insertions(+), 29 deletions(-) diff --git a/arch/arm64/net/bpf_jit_comp.c b/arch/arm64/net/bpf_jit_comp.c index 0c9a50a1e73e..17e6a041ea4d 100644 --- a/arch/arm64/net/bpf_jit_comp.c +++ b/arch/arm64/net/bpf_jit_comp.c @@ -2939,7 +2939,7 @@ int bpf_arch_text_poke(void *ip, enum bpf_text_poke_t= ype poke_type, u64 plt_target =3D 0ULL; bool poking_bpf_entry; =20 - 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. diff --git a/arch/powerpc/net/bpf_jit_comp.c b/arch/powerpc/net/bpf_jit_com= p.c index 88ad5ba7b87f..21f7f26a5e2f 100644 --- a/arch/powerpc/net/bpf_jit_comp.c +++ b/arch/powerpc/net/bpf_jit_comp.c @@ -1122,7 +1122,7 @@ int bpf_arch_text_poke(void *ip, enum bpf_text_poke_t= ype poke_type, branch_flags =3D poke_type =3D=3D BPF_MOD_CALL ? BRANCH_SET_LINK : 0; =20 /* 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_f= unc); return -EOPNOTSUPP; } diff --git a/include/linux/filter.h b/include/linux/filter.h index 973233b82dc1..0189f7488044 100644 --- a/include/linux/filter.h +++ b/include/linux/filter.h @@ -1373,24 +1373,13 @@ static inline bool bpf_jit_kallsyms_enabled(void) return false; } =20 -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); =20 -static inline int -bpf_address_lookup(unsigned long addr, unsigned long *size, - unsigned long *off, char **modname, char *sym) -{ - int ret =3D __bpf_address_lookup(addr, size, off, sym); - - if (ret && modname) - *modname =3D NULL; - return ret; -} - void bpf_prog_kallsyms_add(struct bpf_prog *fp); void bpf_prog_kallsyms_del(struct bpf_prog *fp); =20 @@ -1429,8 +1418,8 @@ static inline bool bpf_jit_kallsyms_enabled(void) } =20 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; } @@ -1451,13 +1440,6 @@ static inline struct bpf_prog *bpf_prog_ksym_find(un= signed long addr) return NULL; } =20 -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) { } diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c index d595fe512498..c2278f392e93 100644 --- a/kernel/bpf/core.c +++ b/kernel/bpf/core.c @@ -713,8 +713,8 @@ static struct bpf_ksym *bpf_ksym_find(unsigned long add= r) return n ? container_of(n, struct bpf_ksym, tnode) : NULL; } =20 -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 =3D 0; diff --git a/kernel/kallsyms.c b/kernel/kallsyms.c index f25b122397ce..97b92fc8871d 100644 --- a/kernel/kallsyms.c +++ b/kernel/kallsyms.c @@ -342,7 +342,7 @@ int kallsyms_lookup_size_offset(unsigned long addr, uns= igned long *symbolsize, return 1; } return !!module_address_lookup(addr, symbolsize, offset, NULL, NULL, name= buf) || - !!__bpf_address_lookup(addr, symbolsize, offset, namebuf); + !!bpf_address_lookup(addr, symbolsize, offset, namebuf); } =20 static int kallsyms_lookup_buildid(unsigned long addr, @@ -383,8 +383,7 @@ static int kallsyms_lookup_buildid(unsigned long addr, ret =3D module_address_lookup(addr, symbolsize, offset, modname, modbuildid, namebuf); if (!ret) - ret =3D bpf_address_lookup(addr, symbolsize, - offset, modname, namebuf); + ret =3D bpf_address_lookup(addr, symbolsize, offset, namebuf); =20 if (!ret) ret =3D ftrace_mod_address_lookup(addr, symbolsize, --=20 2.52.0