Skip to content

bpf: Recognize special arithmetic shift in the verifier

Puranjay Mohan bpf 2 versions – Applied

Status from this message: This series was applied to bpf/bpf-next.git (master)

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest2 patches 0 repliesApplied 2/2
  2. v32 patches 10 repliesSuperseded

Changes in v4 from the cover letter

- Fork verifier state while processing BPF_OR when src_reg has [-1,0] range and 2nd operand is a constant. This is to detect the following pattern:

Patches in v4 All 2 applied

#Subject and filesSizeRepliesApplied
1/2bpf: Recognize special arithmetic shift in the verifierkernel/bpf/verifier.c+39 -00 repliesApplied
2/2selftests/bpf: Add tests for s>>=31 and s>>=63tools/testing/selftests/bpf/progs/verifier_subreg.c+85 -00 repliesApplied

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v4 yet.

Read the v4 thread

Cover letter [PATCH bpf-next v4 0/2] bpf: Recognize special arithmetic shift in the verifier

v3: https://lore.kernel.org/all/[email protected]/
Changes in v3->v4:
- Fork verifier state while processing BPF_OR when src_reg has [-1,0] range and 2nd operand is a constant. This is to detect the following pattern:

	i32 X > -1 ? C1 : -1 --> (X >>s 31) | C1

- Add selftests for above.
- Remove __description("s>>=63") (Eduard in another patchset)

v2: https://lore.kernel.org/bpf/[email protected]/
Changes in v2->v3:
- fork verifier state while processing BPF_AND when src_reg has [-1,0] range and 2nd operand is a constant.

v1->v2:
Use __mark_reg32_known() or __mark_reg_known() for zero too. Add comment to selftest.

v1:
https://lore.kernel.org/bpf/[email protected]/

Alexei Starovoitov (2):
bpf: Recognize special arithmetic shift in the verifier selftests/bpf: Add tests for s>>=31 and s>>=63

 kernel/bpf/verifier.c                         | 39 +++++++++
 .../selftests/bpf/progs/verifier_subreg.c     | 85 +++++++++++++++++++
 2 files changed, 124 insertions(+)

base-commit: 5714ca8cba5ed736f3733663c446cbee63a10a64

Signature · 1 line
2.47.3