diff options
| author | Jiayuan Chen <jiayuan.chen@linux.dev> | 2026-11-17 20:24:13 +0800 |
|---|---|---|
| committer | Alexei Starovoitov <ast@kernel.org> | 2026-11-19 22:26:13 +0000 |
| commit | 7543d8d314b222452258b30e5c7a40c6f4cbfcda (patch) | |
| tree | f3e0962e5051676cd933a371d8ae30f3178c175b /include/linux | |
| parent | 4b4eb7f44ee05754339d07e9df649809f45d14c5 (diff) | |
selftests/bpf: Fix bpf-gcc CO-RE relocation in verifier_sockmap_mutate
bpf-gcc fails to load test_trace_iter_unix:
Error: #766/6 verifier_sockmap_mutate/test_trace_iter_unix
libbpf: elf: skipping section(3) .data (size 0)
libbpf: elf: skipping unrecognized data section(18) .comment
run_subtest:PASS:obj_open_mem 0 nsec
libbpf: prog 'test_trace_iter_unix': relo #0: insn #0 (LDX/ST/STX) accesses field incorrectly. ...
libbpf: prog 'test_trace_iter_unix': BPF program load failed: -EINVAL
libbpf: prog 'test_trace_iter_unix': failed to load: -EINVAL
libbpf: failed to load object 'verifier_sockmap_mutate'
run_subtest:PASS:unexpected_load_success 0 nsec
validate_msgs:FAIL:1014 expect_msg
VERIFIER LOG:
=============
0: R1=ctx() R10=fp0
; @ verifier_sockmap_mutate.c:124
0: <invalid CO-RE relocation>
failed to resolve CO-RE relocation <byte_off> [4] struct bpf_iter__unix (0:0 @ offset 0)
processed 1 insns (limit 1000000) max_states_per_insn 0 total_states 0 peak_states 0 mark_read 0
=============
EXPECTED SUBSTR: 'cannot update sockmap in this context'
GCC only applies preserve_access_index to types that carry the attribute
themselves. The anonymous union holding the sock pointer doesn't, so the
CO-RE access stops at the union ("0:0") instead of reaching the pointer
("0:0:0"), and libbpf rejects the relocation.
Fixes: e16c83fa764f ("selftests/bpf: Add negative test for sockmap update from non-sockmap iter")
Signed-off-by: Jiayuan Chen <jiayuan.chen@linux.dev>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Ihor Solodrai <ihor.solodrai@linux.dev>
Link: https://patch.msgid.link/20261117122417.340562-1-jiayuan.chen@linux.dev
Diffstat (limited to 'include/linux')
0 files changed, 0 insertions, 0 deletions
