lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8ec25079f9ee20495409e08b6a1e08a9076dcc29.1744169424.git.dxu@dxuuu.xyz>
Date: Tue,  8 Apr 2025 21:34:02 -0600
From: Daniel Xu <dxu@...uu.xyz>
To: andrii@...nel.org,
	ast@...nel.org,
	daniel@...earbox.net
Cc: martin.lau@...ux.dev,
	eddyz87@...il.com,
	song@...nel.org,
	yonghong.song@...ux.dev,
	john.fastabend@...il.com,
	kpsingh@...nel.org,
	sdf@...ichev.me,
	haoluo@...gle.com,
	jolsa@...nel.org,
	bpf@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: [RFC bpf-next 07/13] bpf: Make bpf_free_kfunc_btf_tab() static in core

This function is only used in one place in core. However, it was defined
in verifier.c b/c a bunch of struct definitions were hidden in
verifier.c. Now that those definitions are shared, we can move
bpf_free_kfunc_btf_tab() into core and mark it static.

Signed-off-by: Daniel Xu <dxu@...uu.xyz>
---
 include/linux/bpf_verifier.h |  2 --
 kernel/bpf/core.c            | 13 +++++++++++++
 kernel/bpf/verifier.c        | 12 ------------
 3 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/include/linux/bpf_verifier.h b/include/linux/bpf_verifier.h
index f61f5429647a..f9a203e5f042 100644
--- a/include/linux/bpf_verifier.h
+++ b/include/linux/bpf_verifier.h
@@ -879,8 +879,6 @@ static inline void bpf_trampoline_unpack_key(u64 key, u32 *obj_id, u32 *btf_id)
 		*btf_id = key & 0x7FFFFFFF;
 }
 
-void bpf_free_kfunc_btf_tab(struct bpf_kfunc_btf_tab *tab);
-
 int mark_chain_precision(struct bpf_verifier_env *env, int regno);
 
 #define BPF_BASE_TYPE_MASK	GENMASK(BPF_BASE_TYPE_BITS - 1, 0)
diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c
index 8cbfe7d33c0a..e892e469061e 100644
--- a/kernel/bpf/core.c
+++ b/kernel/bpf/core.c
@@ -3251,6 +3251,19 @@ static void bpf_free_used_btfs(struct bpf_prog_aux *aux)
 	kfree(aux->used_btfs);
 }
 
+static void bpf_free_kfunc_btf_tab(struct bpf_kfunc_btf_tab *tab)
+{
+	if (!tab)
+		return;
+
+	while (tab->nr_descs--) {
+		module_put(tab->descs[tab->nr_descs].module);
+		btf_put(tab->descs[tab->nr_descs].btf);
+	}
+	kfree(tab);
+}
+
+
 static void bpf_prog_free_deferred(struct work_struct *work)
 {
 	struct bpf_prog_aux *aux;
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 161280f3371f..7e84df2abe41 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -3029,18 +3029,6 @@ static struct btf *__find_kfunc_desc_btf(struct bpf_verifier_env *env,
 	return btf;
 }
 
-void bpf_free_kfunc_btf_tab(struct bpf_kfunc_btf_tab *tab)
-{
-	if (!tab)
-		return;
-
-	while (tab->nr_descs--) {
-		module_put(tab->descs[tab->nr_descs].module);
-		btf_put(tab->descs[tab->nr_descs].btf);
-	}
-	kfree(tab);
-}
-
 static struct btf *find_kfunc_desc_btf(struct bpf_verifier_env *env, s16 offset)
 {
 	if (offset) {
-- 
2.47.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ