From: Alexei Starovoitov <alexei.starovoitov@gmail.com>
To: bpf@vger.kernel.org
Cc: daniel@iogearbox.net, andrii@kernel.org, martin.lau@kernel.org,
memxor@gmail.com, eddyz87@gmail.com, kernel-team@fb.com
Subject: [PATCH v3 bpf-next 0/4] bpf: Track delta between "linked" registers.
Date: Wed, 12 Jun 2024 18:38:11 -0700 [thread overview]
Message-ID: <20240613013815.953-1-alexei.starovoitov@gmail.com> (raw)
From: Alexei Starovoitov <ast@kernel.org>
v2->v3:
- Fixed test_verifier due to output change
- Fixed regsafe()
- Add another test
v1->v2:
- Fixed find_equal_scalars() logic. off,id,add_const flag must be
preserved.
- Fixed mark_precise_scalar_ids() that should ignore add_const bit in ID.
- Fixed asm test and added two more tests.
- Gate the feature by cap_bpf.
v1:
Compilers can generate the code
r1 = r2
r1 += 0x1
if r2 < 1000 goto ...
use knowledge of r2 range in subsequent r1 operations
The "undo" pass was introduced in LLVM
https://reviews.llvm.org/D121937
to prevent this optimization, but it cannot cover all cases.
Instead of fighting middle end optimizer in BPF backend teach the verifier
about this pattern.
The veristat difference:
File Program Insns (A) Insns (B) Insns (DIFF)
---------------------------------- ------------------ --------- --------- ----------------
arena_htab.bpf.o arena_htab_llvm 18656 747 -17909 (-96.00%)
arena_htab_asm.bpf.o arena_htab_asm 18523 618 -17905 (-96.66%)
iters.bpf.o iter_subprog_iters 1109 981 -128 (-11.54%)
verifier_iterating_callbacks.bpf.o cond_break2 113 128 +15 (+13.27%)
Alexei Starovoitov (4):
bpf: Relax tuple len requirement for sk helpers.
bpf: Track delta between "linked" registers.
bpf: Support can_loop/cond_break on big endian
selftests/bpf: Add tests for add_const
include/linux/bpf_verifier.h | 12 +-
kernel/bpf/log.c | 4 +-
kernel/bpf/verifier.c | 95 ++++++-
net/core/filter.c | 24 +-
.../testing/selftests/bpf/bpf_experimental.h | 28 +++
.../testing/selftests/bpf/progs/arena_htab.c | 16 +-
.../bpf/progs/verifier_iterating_callbacks.c | 236 ++++++++++++++++++
.../testing/selftests/bpf/verifier/precise.c | 22 +-
8 files changed, 398 insertions(+), 39 deletions(-)
--
2.43.0
next reply other threads:[~2024-06-13 1:38 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-13 1:38 Alexei Starovoitov [this message]
2024-06-13 1:38 ` [PATCH v3 bpf-next 1/4] bpf: Relax tuple len requirement for sk helpers Alexei Starovoitov
2024-06-13 1:38 ` [PATCH v3 bpf-next 2/4] bpf: Track delta between "linked" registers Alexei Starovoitov
2024-06-13 16:10 ` Eduard Zingerman
2024-06-13 1:38 ` [PATCH v3 bpf-next 3/4] bpf: Support can_loop/cond_break on big endian Alexei Starovoitov
2024-06-13 1:38 ` [PATCH v3 bpf-next 4/4] selftests/bpf: Add tests for add_const Alexei Starovoitov
2024-06-14 20:00 ` [PATCH v3 bpf-next 0/4] bpf: Track delta between "linked" registers patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240613013815.953-1-alexei.starovoitov@gmail.com \
--to=alexei.starovoitov@gmail.com \
--cc=andrii@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=kernel-team@fb.com \
--cc=martin.lau@kernel.org \
--cc=memxor@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox