unprivileged tests in test_verifier from ubuntu_bpf failed with "Failed to load prog 'Operation not permitted'" on B-4.15
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
ubuntu-kernel-tests |
Fix Released
|
Undecided
|
Po-Hsu Lin | ||
linux (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned | ||
Bionic |
Fix Released
|
Undecided
|
Po-Hsu Lin |
Bug Description
[Impact]
We have kernel.
$ sysctl kernel.
kernel.
This causes all unprivileged tests in test_verifier of bpf selftests
to fail like:
#0/u add+sub+mul FAIL
Failed to load prog 'Operation not permitted'!
Because it permanently disables unprivileged BPF access for
the currently running kernel.
[Fix]
* d0a0e4956f ("selftests/bpf: Count tests skipped by unpriv")
* 0a67487403 ("selftests/bpf: Only run tests if !bpf_disabled")
These two patches can be cherry-picked into our Bionic kernel.
Note that there is a follow-up fix for 0a67487403, which is commit
deea81228b ("selftests/bpf: check return value of fopen in
test_verifier.c"), but this is intended for older kernels (< 4.4) thus
I will leave it alone.
[Test]
Patch tested with Bionic 4.15.0-188, and these unprivileged won't fail
with "Failed to load prog 'Operation not permitted'!" anymore, they
will be marked as skipped tests.
Overall test result improves from:
Summary: 551 PASSED, 286 FAILED
To:
Summary: 551 PASSED, 278 SKIPPED, 8 FAILED
[Where problems could occur]
Change limited to the bpf selftest code, no actual changes to kernel
function. If this fix is wrong, we might get incorrect test results.
[Original Bug Report]
Issue found on Bionic 4.15 cloud variants (as we don't run this test on bare-metals)
#0/u add+sub+mul FAIL
Failed to load prog 'Operation not permitted'!
--
#1/u DIV32 by 0, zero check 1 FAIL
Failed to load prog 'Operation not permitted'!
--
#2/u DIV32 by 0, zero check 2 FAIL
Failed to load prog 'Operation not permitted'!
--
#3/u DIV64 by 0, zero check FAIL
Failed to load prog 'Operation not permitted'!
--
#4/u MOD32 by 0, zero check 1 FAIL
Failed to load prog 'Operation not permitted'!
--
#5/u MOD32 by 0, zero check 2 FAIL
Failed to load prog 'Operation not permitted'!
--
#6/u MOD64 by 0, zero check FAIL
Failed to load prog 'Operation not permitted'!
--
#36/u test6 ld_imm64 FAIL
Failed to load prog 'Operation not permitted'!
--
#37/u test7 ld_imm64 FAIL
Failed to load prog 'Operation not permitted'!
--
#46/u arsh64 on imm FAIL
Failed to load prog 'Operation not permitted'!
--
#47/u arsh64 on reg FAIL
Failed to load prog 'Operation not permitted'!
--
#60/u uninitialized stack1 Failed to create hash map 'Operation not permitted'!
--
#63/u non-invalid fp arithmetic FAIL
Failed to load prog 'Operation not permitted'!
--
#67/u check valid spill/fill, skb mark FAIL
Failed to load prog 'Operation not permitted'!
--
#81/u don't check return value before access Failed to create hash map 'Operation not permitted'!
--
#82/u access memory with incorrect alignment Failed to create hash map 'Operation not permitted'!
--
#83/u sometimes access memory with incorrect alignment Failed to create hash map 'Operation not permitted'!
--
#86/u jump test 3 Failed to create hash map 'Operation not permitted'!
--
#89/u access skb fields ok FAIL
Failed to load prog 'Operation not permitted'!
--
#91/u access skb fields bad2 Failed to create hash map 'Operation not permitted'!
--
#92/u access skb fields bad3 Failed to create hash map 'Operation not permitted'!
--
#93/u access skb fields bad4 Failed to create hash map 'Operation not permitted'!
--
#118/u check cb access: byte FAIL
Failed to load prog 'Operation not permitted'!
--
#121/u check skb->hash byte load permitted FAIL
Failed to load prog 'Operation not permitted'!
--
#126/u check cb access: half FAIL
Failed to load prog 'Operation not permitted'!
--
#130/u check skb->hash half load permitted FAIL
Failed to load prog 'Operation not permitted'!
--
#133/u check cb access: word FAIL
Failed to load prog 'Operation not permitted'!
--
#138/u check cb access: double FAIL
Failed to load prog 'Operation not permitted'!
--
#149/u PTR_TO_STACK store/load FAIL
Failed to load prog 'Operation not permitted'!
--
#155/u unpriv: add const to pointer FAIL
Failed to load prog 'Operation not permitted'!
--
#161/u unpriv: pass pointer to helper function Failed to create hash map 'Operation not permitted'!
--
#162/u unpriv: indirectly pass pointer on stack to helper function Failed to create hash map 'Operation not permitted'!
--
#167/u unpriv: spill/fill of ctx FAIL
Failed to load prog 'Operation not permitted'!
--
#173/u unpriv: write pointer into map elem value Failed to create hash map 'Operation not permitted'!
--
#174/u alu32: mov u32 const FAIL
Failed to load prog 'Operation not permitted'!
--
#176/u unpriv: pass pointer to tail_call Failed to create prog array 'Operation not permitted'!
--
#177/u unpriv: cmp map pointer with zero Failed to create hash map 'Operation not permitted'!
--
#184/u runtime/jit: pass negative index to tail_call Failed to create prog array 'Operation not permitted'!
FAIL
Failed to load prog 'Operation not permitted'!
#185/u runtime/jit: pass > 32bit index to tail_call Failed to create prog array 'Operation not permitted'!
FAIL
Failed to load prog 'Operation not permitted'!
--
#186/u PTR_TO_STACK check high 1 FAIL
Failed to load prog 'Operation not permitted'!
--
#187/u PTR_TO_STACK check high 2 FAIL
Failed to load prog 'Operation not permitted'!
--
#193/u PTR_TO_STACK check low 1 FAIL
Failed to load prog 'Operation not permitted'!
--
#200/u PTR_TO_STACK mixed reg/k, 1 FAIL
Failed to load prog 'Operation not permitted'!
--
#201/u PTR_TO_STACK mixed reg/k, 2 FAIL
Failed to load prog 'Operation not permitted'!
--
#202/u PTR_TO_STACK mixed reg/k, 3 FAIL
Failed to load prog 'Operation not permitted'!
--
#203/u PTR_TO_STACK reg FAIL
Failed to load prog 'Operation not permitted'!
--
#204/u stack pointer arithmetic FAIL
Failed to load prog 'Operation not permitted'!
--
#273/u valid map access into an array with a constant Failed to create hash map 'Operation not permitted'!
--
#274/u valid map access into an array with a register Failed to create hash map 'Operation not permitted'!
--
#275/u valid map access into an array with a variable Failed to create hash map 'Operation not permitted'!
--
#276/u valid map access into an array with a signed variable Failed to create hash map 'Operation not permitted'!
--
#277/u invalid map access into an array with a constant Failed to create hash map 'Operation not permitted'!
--
#278/u invalid map access into an array with a register Failed to create hash map 'Operation not permitted'!
--
#279/u invalid map access into an array with a variable Failed to create hash map 'Operation not permitted'!
--
#280/u invalid map access into an array with no floor check Failed to create hash map 'Operation not permitted'!
--
#281/u invalid map access into an array with a invalid max check Failed to create hash map 'Operation not permitted'!
--
#282/u invalid map access into an array with a invalid max check Failed to create hash map 'Operation not permitted'!
--
#289/u invalid map access from else condition Failed to create hash map 'Operation not permitted'!
--
#305/u leak pointer into ctx 1 Failed to create hash map 'Operation not permitted'!
--
#307/u leak pointer into ctx 3 Failed to create hash map 'Operation not permitted'!
--
#308/u leak pointer into map val Failed to create hash map 'Operation not permitted'!
--
#341/u map element value is preserved across register spilling Failed to create hash map 'Operation not permitted'!
--
#342/u map element value or null is marked on register spilling Failed to create hash map 'Operation not permitted'!
--
#343/u map element value store of cleared call register Failed to create hash map 'Operation not permitted'!
--
#344/u map element value with unaligned store Failed to create hash map 'Operation not permitted'!
--
#345/u map element value with unaligned load Failed to create hash map 'Operation not permitted'!
--
#346/u map element value illegal alu op, 1 Failed to create hash map 'Operation not permitted'!
--
#347/u map element value illegal alu op, 2 Failed to create hash map 'Operation not permitted'!
--
#348/u map element value illegal alu op, 3 Failed to create hash map 'Operation not permitted'!
--
#349/u map element value illegal alu op, 4 Failed to create hash map 'Operation not permitted'!
--
#350/u map element value illegal alu op, 5 Failed to create hash map 'Operation not permitted'!
--
#351/u map element value is preserved across register spilling Failed to create hash map 'Operation not permitted'!
--
#381/u invalid and of negative number Failed to create hash map 'Operation not permitted'!
--
#382/u invalid range check Failed to create hash map 'Operation not permitted'!
--
#383/u map in map access Failed to create array 'Operation not permitted'!
FAIL
Failed to load prog 'Operation not permitted'!
#384/u invalid inner map pointer Failed to create array 'Operation not permitted'!
--
#385/u forgot null checking on the inner map pointer Failed to create array 'Operation not permitted'!
--
#391/u ld_abs: check calling conv, r7 FAIL
Failed to load prog 'Operation not permitted'!
--
#398/u ld_ind: check calling conv, r7 FAIL
Failed to load prog 'Operation not permitted'!
--
#405/u bounds checks mixing signed and unsigned, positive bounds Failed to create hash map 'Operation not permitted'!
--
#406/u bounds checks mixing signed and unsigned Failed to create hash map 'Operation not permitted'!
--
#407/u bounds checks mixing signed and unsigned, variant 2 Failed to create hash map 'Operation not permitted'!
--
#408/u bounds checks mixing signed and unsigned, variant 3 Failed to create hash map 'Operation not permitted'!
--
#409/u bounds checks mixing signed and unsigned, variant 4 Failed to create hash map 'Operation not permitted'!
FAIL
Failed to load prog 'Operation not permitted'!
#410/u bounds checks mixing signed and unsigned, variant 5 Failed to create hash map 'Operation not permitted'!
--
#412/u bounds checks mixing signed and unsigned, variant 7 Failed to create hash map 'Operation not permitted'!
FAIL
Failed to load prog 'Operation not permitted'!
#413/u bounds checks mixing signed and unsigned, variant 8 Failed to create hash map 'Operation not permitted'!
--
#414/u bounds checks mixing signed and unsigned, variant 9 Failed to create hash map 'Operation not permitted'!
FAIL
Failed to load prog 'Operation not permitted'!
#415/u bounds checks mixing signed and unsigned, variant 10 Failed to create hash map 'Operation not permitted'!
--
#416/u bounds checks mixing signed and unsigned, variant 11 Failed to create hash map 'Operation not permitted'!
--
#417/u bounds checks mixing signed and unsigned, variant 12 Failed to create hash map 'Operation not permitted'!
--
#418/u bounds checks mixing signed and unsigned, variant 13 Failed to create hash map 'Operation not permitted'!
--
#419/u bounds checks mixing signed and unsigned, variant 14 Failed to create hash map 'Operation not permitted'!
--
#420/u bounds checks mixing signed and unsigned, variant 15 Failed to create hash map 'Operation not permitted'!
--
#421/u subtraction bounds (map value) variant 1 Failed to create hash map 'Operation not permitted'!
--
#422/u subtraction bounds (map value) variant 2 Failed to create hash map 'Operation not permitted'!
--
#423/u check subtraction on pointers for unpriv Failed to create hash map 'Operation not permitted'!
--
#424/u bounds check based on zero-extended MOV Failed to create hash map 'Operation not permitted'!
FAIL
Failed to load prog 'Operation not permitted'!
#425/u bounds check based on sign-extended MOV. test1 Failed to create hash map 'Operation not permitted'!
--
#426/u bounds check based on sign-extended MOV. test2 Failed to create hash map 'Operation not permitted'!
--
#429/u bounds check after truncation of non-boundary-
FAIL
Failed to load prog 'Operation not permitted'!
#430/u bounds check after truncation of boundary-crossing range (1) Failed to create hash map 'Operation not permitted'!
--
#431/u bounds check after truncation of boundary-crossing range (2) Failed to create hash map 'Operation not permitted'!
--
#432/u bounds check after wrapping 32-bit addition Failed to create hash map 'Operation not permitted'!
FAIL
Failed to load prog 'Operation not permitted'!
#433/u bounds check after shift with oversized count operand Failed to create hash map 'Operation not permitted'!
--
#434/u bounds check after right shift of maybe-negative number Failed to create hash map 'Operation not permitted'!
--
#435/u bounds check after 32-bit right shift with 64-bit input Failed to create hash map 'Operation not permitted'!
--
#436/u bounds check map access with off+size signed 32bit overflow. test1 Failed to create hash map 'Operation not permitted'!
--
#437/u bounds check map access with off+size signed 32bit overflow. test2 Failed to create hash map 'Operation not permitted'!
--
#438/u bounds check map access with off+size signed 32bit overflow. test3 Failed to create hash map 'Operation not permitted'!
--
#439/u bounds check map access with off+size signed 32bit overflow. test4 Failed to create hash map 'Operation not permitted'!
--
#440/u pointer/scalar confusion in state equality check (way 1) Failed to create hash map 'Operation not permitted'!
--
#441/u pointer/scalar confusion in state equality check (way 2) Failed to create hash map 'Operation not permitted'!
--
#449/u varlen_
--
#539/u masking, test out of bounds 1 FAIL
Failed to load prog 'Operation not permitted'!
--
#540/u masking, test out of bounds 2 FAIL
Failed to load prog 'Operation not permitted'!
--
#541/u masking, test out of bounds 3 FAIL
Failed to load prog 'Operation not permitted'!
--
#542/u masking, test out of bounds 4 FAIL
Failed to load prog 'Operation not permitted'!
--
#543/u masking, test out of bounds 5 FAIL
Failed to load prog 'Operation not permitted'!
--
#544/u masking, test out of bounds 6 FAIL
Failed to load prog 'Operation not permitted'!
--
#545/u masking, test out of bounds 7 FAIL
Failed to load prog 'Operation not permitted'!
--
#546/u masking, test out of bounds 8 FAIL
Failed to load prog 'Operation not permitted'!
--
#547/u masking, test out of bounds 9 FAIL
Failed to load prog 'Operation not permitted'!
--
#548/u masking, test out of bounds 10 FAIL
Failed to load prog 'Operation not permitted'!
--
#549/u masking, test out of bounds 11 FAIL
Failed to load prog 'Operation not permitted'!
--
#550/u masking, test out of bounds 12 FAIL
Failed to load prog 'Operation not permitted'!
--
#551/u masking, test in bounds 1 FAIL
Failed to load prog 'Operation not permitted'!
--
#552/u masking, test in bounds 2 FAIL
Failed to load prog 'Operation not permitted'!
--
#553/u masking, test in bounds 3 FAIL
Failed to load prog 'Operation not permitted'!
--
#554/u masking, test in bounds 4 FAIL
Failed to load prog 'Operation not permitted'!
--
#555/u masking, test in bounds 5 FAIL
Failed to load prog 'Operation not permitted'!
--
#556/u masking, test in bounds 6 FAIL
Failed to load prog 'Operation not permitted'!
--
#557/u masking, test in bounds 7 FAIL
Failed to load prog 'Operation not permitted'!
--
#558/u masking, test in bounds 8 FAIL
Failed to load prog 'Operation not permitted'!
....
Summary: 551 PASSED, 286 FAILED
It looks like these tests are "unprivileged tests".
Bisect shows this happens between 4.15.0-169-generic and 4.15.0-171-generic
description: | updated |
description: | updated |
Changed in linux (Ubuntu): | |
status: | New → Fix Released |
summary: |
- Some tests in test_verifier from ubuntu_bpf failed with "Failed to load - prog 'Operation not permitted'" on B-4.15 + unprivileged tests in test_verifier from ubuntu_bpf failed with "Failed + to load prog 'Operation not permitted'" on B-4.15 |
Changed in linux (Ubuntu Bionic): | |
status: | New → In Progress |
assignee: | nobody → Po-Hsu Lin (cypressyew) |
Changed in ubuntu-kernel-tests: | |
assignee: | nobody → Po-Hsu Lin (cypressyew) |
status: | New → In Progress |
description: | updated |
description: | updated |
description: | updated |
Changed in linux (Ubuntu Bionic): | |
status: | In Progress → Fix Committed |
Please find attachment for the complete test log of this test-verifier test.