Skip to content

bpf: provide better register bounds after jmp32 instructions

Yonghong Song bpf 2 versions In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 1 replyIn review
  2. v12 patches 2 repliesSuperseded

Changes in v2 from the cover letter

- do not directly manipulate tnum.{value,mask} in __reg_bound_offset32(), using tnum_lshift/tnum_rshift functions instead
- do __reg_bound_offset32() after regular 64bit __reg_bound_offset() since the latter may give a better upper 32bit var_off, which can be inherited by __reg_bound_offset32().

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2bpf: provide better register bounds after jmp32 instructionskernel/bpf/verifier.c+19 -00 replies
2/2tools/bpf: add verifier tests for better jmp32 register boundstools/testing/selftests/bpf/verifier/jmp32.c+83 -00 replies

Reviews trailers per patch

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

Read the v2 thread

Cover letter [PATCH bpf-next v2 0/2] bpf: provide better register bounds after jmp32 instructions

With latest llvm, bpf selftest test_progs, which has +alu32 enabled, failed for strobemeta.o and a few other subtests. The reason is due to that verifier did not provide better var_off.mask after jmp32 instructions. This patch set addressed this issue and after the fix, test_progs passed with alu32.

Patch #1 provided detailed explanation of the problem and the fix. Patch #2 added three tests in test_verifier.

Changelog:
v1 -> v2:
- do not directly manipulate tnum.{value,mask} in __reg_bound_offset32(), using tnum_lshift/tnum_rshift functions instead
- do __reg_bound_offset32() after regular 64bit __reg_bound_offset() since the latter may give a better upper 32bit var_off, which can be inherited by __reg_bound_offset32().

Yonghong Song (2):
bpf: provide better register bounds after jmp32 instructions tools/bpf: add verifier tests for better jmp32 register bounds

 kernel/bpf/verifier.c                        | 19 +++++
 tools/testing/selftests/bpf/verifier/jmp32.c | 83 ++++++++++++++++++++
 2 files changed, 102 insertions(+)
Signature · 1 line
2.17.1