diff options
| author | Alexei Starovoitov <ast@kernel.org> | 2026-10-02 12:47:00 +0000 |
|---|---|---|
| committer | Kumar Kartikeya Dwivedi <memxor@gmail.com> | 2026-10-03 16:08:15 +0200 |
| commit | 72c0681c0e75aa4fe6ce46ac0bb63fb5be9132d7 (patch) | |
| tree | 445cd55c841a8d289b8b344b9e06f74876f9dc00 /include/uapi/linux | |
| parent | 5ec398d9ec8fe13f8058af9a2e5f5e8f46e0a35a (diff) | |
| download | linux-next-72c0681c0e75aa4fe6ce46ac0bb63fb5be9132d7.tar.gz linux-next-72c0681c0e75aa4fe6ce46ac0bb63fb5be9132d7.zip | |
bpf: Allow bitwise ops, shifts and mul/div on pointers with CAP_PERFMON
Rust's core::fmt keeps a flag in the low bit of a pointer:
r2 = *(u64 *)(r1 + 0)
r3 = r2
r3 &= 1
r2 >>= 1
The verifier rejects it:
r0 &= 8
R0 bitwise operator &= on pointer prohibited
Negation and byte swap of a pointer already produce a number when
allow_ptr_leaks is set. Do the same for bitwise ops, shifts, *=, /= and
%=, 64-bit and 32-bit. The result is an unknown number. With CAP_PERFMON
the program can store the pointer and load it back as a number already.
+= and -= are not changed: they keep the pointer, 32-bit += is rejected.
Pointers that allow no arithmetic and pointers that may be NULL are
still rejected.
Two tests in verifier_value_illegal_alu store through the result of
&= and /=. They are rejected at the store now. Update expected messages.
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20261002124714.180012-2-alexei.starovoitov@gmail.com
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Diffstat (limited to 'include/uapi/linux')
0 files changed, 0 insertions, 0 deletions
