public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf-next 0/2] bpf: Unify special map field validation in verifier
@ 2026-01-29 17:38 Mykyta Yatsenko
  2026-01-29 17:38 ` [PATCH bpf-next 1/2] bpf: Introduce struct bpf_map_desc " Mykyta Yatsenko
  2026-01-29 17:38 ` [PATCH bpf-next 2/2] bpf: Consolidate special map field validation " Mykyta Yatsenko
  0 siblings, 2 replies; 8+ messages in thread
From: Mykyta Yatsenko @ 2026-01-29 17:38 UTC (permalink / raw)
  To: bpf, ast, andrii, daniel, kafai, kernel-team, eddyz87, ameryhung
  Cc: Mykyta Yatsenko

The BPF verifier validates pointers to special map fields (timers,
workqueues, task_work) through separate functions that share nearly
identical logic. This creates code duplication because of the
inconsistent data structure layout in struct bpf_call_arg_meta struct
bpf_kfunc_call_arg_meta.

This series contains 2 commits:

1. Introduces struct bpf_map_desc to provide a unified representation
for map pointer and uid tracking. Previously, bpf_call_arg_meta used
separate map_ptr and map_uid fields while bpf_kfunc_call_arg_metaused an
anonymous inline struct. This inconsistency made it harder to share
validation code between the two paths.

2. Consolidates the validation logic for BPF_TIMER, BPF_WORKQUEUE, and
BPF_TASK_WORK field types into a single check_map_field_pointer()
function. This eliminates process_wq_func() and process_task_work_func()
entirely, and simplifies process_timer_func() to just the PREEMPT_RT
check before calling the unified validation. The result is fewer
lines of code with clearer structure for future maintenance.

Signed-off-by: Mykyta Yatsenko <yatsenko@meta.com>
---
Mykyta Yatsenko (2):
      bpf: Introduce struct bpf_map_desc in verifier
      bpf: Consolidate special map field validation in verifier

 kernel/bpf/verifier.c | 143 +++++++++++++++++---------------------------------
 1 file changed, 48 insertions(+), 95 deletions(-)
---
base-commit: ae23bc81ddf7c17b663c4ed1b21e35527b0a7131
change-id: 20260129-verif_special_fields-599a67d10425

Best regards,
-- 
Mykyta Yatsenko <yatsenko@meta.com>


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

end of thread, other threads:[~2026-01-30 16:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-29 17:38 [PATCH bpf-next 0/2] bpf: Unify special map field validation in verifier Mykyta Yatsenko
2026-01-29 17:38 ` [PATCH bpf-next 1/2] bpf: Introduce struct bpf_map_desc " Mykyta Yatsenko
2026-01-29 18:09   ` Amery Hung
2026-01-30 15:46     ` Mykyta Yatsenko
2026-01-30 16:00       ` Alexei Starovoitov
2026-01-29 18:36   ` Eduard Zingerman
2026-01-29 17:38 ` [PATCH bpf-next 2/2] bpf: Consolidate special map field validation " Mykyta Yatsenko
2026-01-29 18:34   ` Eduard Zingerman

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