public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf-next 1/2] bpf: Remove a WARN_ON_ONCE warning related to local kptr
@ 2023-08-23 22:55 Yonghong Song
  2023-08-23 22:56 ` [PATCH bpf-next 2/2] selftests/bpf: Add a local kptr test with no special fields Yonghong Song
  2023-08-24  5:16 ` [PATCH bpf-next 1/2] bpf: Remove a WARN_ON_ONCE warning related to local kptr David Marchevsky
  0 siblings, 2 replies; 5+ messages in thread
From: Yonghong Song @ 2023-08-23 22:55 UTC (permalink / raw)
  To: bpf
  Cc: Alexei Starovoitov, Andrii Nakryiko, Daniel Borkmann, kernel-team,
	Martin KaFai Lau

Currently, in function bpf_obj_free_fields(), for local kptr,
a warning will be issued if the struct does not contain any
special fields. But actually the kernel seems totally okay
with a local kptr without any special fields. Permitting
no special fields also aligns with future percpu kptr which
also allows no special fields.

Signed-off-by: Yonghong Song <yonghong.song@linux.dev>
---
 kernel/bpf/syscall.c | 1 -
 1 file changed, 1 deletion(-)

NOTE: I didn't put a fix tag since except the warning
there is no correctness issue here.

diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
index 10666d17b9e3..ebeb0695305a 100644
--- a/kernel/bpf/syscall.c
+++ b/kernel/bpf/syscall.c
@@ -657,7 +657,6 @@ void bpf_obj_free_fields(const struct btf_record *rec, void *obj)
 			if (!btf_is_kernel(field->kptr.btf)) {
 				pointee_struct_meta = btf_find_struct_meta(field->kptr.btf,
 									   field->kptr.btf_id);
-				WARN_ON_ONCE(!pointee_struct_meta);
 				migrate_disable();
 				__bpf_obj_drop_impl(xchgd_field, pointee_struct_meta ?
 								 pointee_struct_meta->record :
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-08-24  5:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-23 22:55 [PATCH bpf-next 1/2] bpf: Remove a WARN_ON_ONCE warning related to local kptr Yonghong Song
2023-08-23 22:56 ` [PATCH bpf-next 2/2] selftests/bpf: Add a local kptr test with no special fields Yonghong Song
2023-08-24  5:31   ` David Marchevsky
2023-08-24  5:56     ` Yonghong Song
2023-08-24  5:16 ` [PATCH bpf-next 1/2] bpf: Remove a WARN_ON_ONCE warning related to local kptr David Marchevsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox