Skip to content

bpf,x64: implement jump padding in jit

Gary Lin bpf netdev 5 versions – Applied

Status from this message: Applied. Thanks a ton for all the hard work you put into it.

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest3 patches 1 replyApplied
  2. v33 patches 4 repliesSuperseded
  3. v2 posting 2/23 patches 2 repliesSuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v2 posting 1/23 patches0 repliesSuperseded
v11 patch10 repliesSuperseded

Changes in v4 from the cover letter

- Add the detailed comments about the possible padding bytes
- Add the second test case which triggers jmp_cond padding and imm32 nop jmp padding.
- Add the new test case as another subprog

Patches in v4 Applied

#Subject and filesSizeRepliesApplied
1/3bpf,x64: pad NOPs to make images converge more easilyarch/x86/net/bpf_jit_comp.c+112 -280 replies
2/3test_bpf: remove EXPECTED_FAIL flag from bpf_fill_maxinsns11lib/test_bpf.c+1 -60 replies
3/3selftests/bpf: Add verifier tests for x64 jit jump paddingtools/testing/selftests/bpf/test_verifier.c tools/testing/selftests/bpf/verifier/jit.c+96 -00 replies

Reviews trailers per patch

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

Read the v4 thread

Cover letter [PATCH v4 0/3] bpf,x64: implement jump padding in jit

This patch series implements jump padding to x64 jit to cover some corner cases that used to consume more than 20 jit passes and caused failure.

v4:
- Add the detailed comments about the possible padding bytes
- Add the second test case which triggers jmp_cond padding and imm32 nop jmp padding.
- Add the new test case as another subprog

v3:
- Copy the instructions of prologue separately or the size calculation of the first BPF instruction would include the prologue.
- Replace WARN_ONCE() with pr_err() and EFAULT
- Use MAX_PASSES in the for loop condition check
- Remove the "padded" flag from x64_jit_data. For the extra pass of subprogs, padding is always enabled since it won't hurt the images that converge without padding.
v2:
- Simplify the sample code in the commit description and provide the jit code
- Check the expected padding bytes with WARN_ONCE
- Move the 'padded' flag to 'struct x64_jit_data'
- Remove the EXPECTED_FAIL flag from bpf_fill_maxinsns11() in test_bpf
- Add 2 verifier tests

Gary Lin (3):
bpf,x64: pad NOPs to make images converge more easily
test_bpf: remove EXPECTED_FAIL flag from bpf_fill_maxinsns11 selftests/bpf: Add verifier tests for x64 jit jump padding

 arch/x86/net/bpf_jit_comp.c                 | 140 ++++++++++++++++----
 lib/test_bpf.c                              |   7 +-
 tools/testing/selftests/bpf/test_verifier.c |  72 ++++++++++
 tools/testing/selftests/bpf/verifier/jit.c  |  24 ++++
 4 files changed, 209 insertions(+), 34 deletions(-)
Signature · 1 line
2.29.2