Bug 205469

Summary: x86_32: bpf: multiple test_bpf failures using eBPF JIT
Product: Networking Reporter: Tony Ambardar (itugrok)
Component: OtherAssignee: Stephen Hemminger (stephen)
Status: RESOLVED CODE_FIX    
Severity: normal CC: itugrok, udknight
Priority: P1    
Hardware: i386   
OS: Linux   
Kernel Version: 4.19.81 LTS Subsystem:
Regression: No Bisected commit-id:
Attachments: test_bpf failures: kernel 4.19.81/x86_32 (OpenWrt)

Description Tony Ambardar 2019-11-08 07:35:59 UTC
Created attachment 285829 [details]
test_bpf failures: kernel 4.19.81/x86_32 (OpenWrt)

Summary:
========

Running the 4.19.81 LTS kernel on QEMU/x86_32, the standard test_bpf.ko testsuite generates multiple errors with the eBPF JIT enabled:

  ...
  test_bpf: #32 JSET jited:1 40 ret 0 != 20 46 FAIL
  test_bpf: #321 LD_IND word positive offset jited:1 ret 0 != -291897430 FAIL
  test_bpf: #322 LD_IND word negative offset jited:1 ret 0 != -1437222042 FAIL
  test_bpf: #323 LD_IND word unaligned (addr & 3 == 2) jited:1 ret 0 != -1150890889 FAIL
  test_bpf: #326 LD_IND word positive offset, all ff jited:1 ret 0 != -1 FAIL
  ...
  test_bpf: Summary: 373 PASSED, 5 FAILED, [344/366 JIT'ed]

However, with eBPF JIT disabled (net.core.bpf_jit_enable=0) all tests pass.


Steps to Reproduce:
===================

  # sysctl net.core.bpf_jit_enable=1
  # modprobe test_bpf
  <Kernel log with failures and test summary>


Affected Systems Tested:
========================

  OpenWrt master on QEMU/pc-q35(x86_32) [LTS kernel 4.19.81]


Kernel Logs:
============

Boot log with test results is attached.
Comment 1 Wang YanQing 2019-11-10 23:34:44 UTC
I have tested and verified that the report bug has been fixed by commit
711aef1bbf88 ("bpf, x32: Fix bug for BPF_JMP | {BPF_JSGT, BPF_JSLE, BPF_JSLT, BPF_JSGE}")

But the fix hasn't been backported to stable trees.
Comment 2 Tony Ambardar 2019-11-11 04:17:21 UTC
Thank you very much for identifying this! I saw your post on bpf mailing list, and question to Daniel Borkmann about backporting to stable trees. I also saw on git that you and others have made a few other fixes to the x32 eBPF JIT code which apply to 4.19 LTS as well.

I'm hoping Daniel can comment on the whole backport question. Is there anything I must do to request backports?
Comment 3 Wang YanQing 2019-11-11 10:36:51 UTC
Nothing, but if you could show the really usecases, there are really users of x32 eBPF JIT code, I will backport them happily:)
Comment 4 Wang YanQing 2019-12-13 09:39:03 UTC
Hi Tony Ambardar!

The patches for this bug has been merged into upstream of 4.19.86, so
could you close this bug report?

Thanks!
Comment 5 Tony Ambardar 2020-05-06 01:39:40 UTC
Thanks and sorry for the delay. Stay healthy!