bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf-next 0/7] BPF verifier state equivalence checks improvements
@ 2022-12-23  5:49 Andrii Nakryiko
  2022-12-23  5:49 ` [PATCH bpf-next 1/7] bpf: teach refsafe() to take into account ID remapping Andrii Nakryiko
                   ` (7 more replies)
  0 siblings, 8 replies; 17+ messages in thread
From: Andrii Nakryiko @ 2022-12-23  5:49 UTC (permalink / raw)
  To: bpf, ast, daniel; +Cc: andrii, kernel-team

This patch set fixes, improves, and refactors parts of BPF verifier's state
equivalence checks.

Patch #1 fixes refsafe(), making it take into account ID map when comparing
reference IDs. See patch for details.

Patches #2-#7 refactor regsafe() function which compares two register states
across old and current states. regsafe() is critical piece of logic, so to
make it easier to review and validate refactorings and logic fixes and
improvements, each patch makes a small change, explaining why the change is
correct and makes sense. Please see individual patches for details.

This patch set is one of the preliminaries required for upcoming BPF
open-coded iterators, as with open-coded iterators verifier's loop safety and
completion proof is critically dependent on correct state equivalence logic.

Andrii Nakryiko (7):
  bpf: teach refsafe() to take into account ID remapping
  bpf: reorganize struct bpf_reg_state fields
  bpf: generalize MAYBE_NULL vs non-MAYBE_NULL rule
  bpf: reject non-exact register type matches in regsafe()
  bpf: perform byte-by-byte comparison only when necessary in regsafe()
  bpf: fix regs_exact() logic in regsafe() to remap IDs correctly
  bpf: unify PTR_TO_MAP_{KEY,VALUE} with default case in regsafe()

 include/linux/bpf_verifier.h |  40 +++++-----
 kernel/bpf/verifier.c        | 151 +++++++++++++++++++----------------
 2 files changed, 101 insertions(+), 90 deletions(-)

-- 
2.30.2


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

end of thread, other threads:[~2023-01-11 19:08 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-23  5:49 [PATCH bpf-next 0/7] BPF verifier state equivalence checks improvements Andrii Nakryiko
2022-12-23  5:49 ` [PATCH bpf-next 1/7] bpf: teach refsafe() to take into account ID remapping Andrii Nakryiko
2022-12-23  5:49 ` [PATCH bpf-next 2/7] bpf: reorganize struct bpf_reg_state fields Andrii Nakryiko
2022-12-23  5:49 ` [PATCH bpf-next 3/7] bpf: generalize MAYBE_NULL vs non-MAYBE_NULL rule Andrii Nakryiko
2022-12-23  5:49 ` [PATCH bpf-next 4/7] bpf: reject non-exact register type matches in regsafe() Andrii Nakryiko
2022-12-23  5:49 ` [PATCH bpf-next 5/7] bpf: perform byte-by-byte comparison only when necessary " Andrii Nakryiko
2022-12-23  5:49 ` [PATCH bpf-next 6/7] bpf: fix regs_exact() logic in regsafe() to remap IDs correctly Andrii Nakryiko
2022-12-23  5:49 ` [PATCH bpf-next 7/7] bpf: unify PTR_TO_MAP_{KEY,VALUE} with default case in regsafe() Andrii Nakryiko
2022-12-28  2:00   ` Alexei Starovoitov
2022-12-29 21:59     ` Andrii Nakryiko
2022-12-30  2:19       ` Alexei Starovoitov
2023-01-03 22:04         ` Andrii Nakryiko
2023-01-04 22:35           ` Alexei Starovoitov
2023-01-04 23:03             ` Andrii Nakryiko
2023-01-05  0:14               ` Alexei Starovoitov
2023-01-11 19:08                 ` Andrii Nakryiko
2022-12-28  2:10 ` [PATCH bpf-next 0/7] BPF verifier state equivalence checks improvements patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).