diff options
author | Andrii Nakryiko <andrii@kernel.org> | 2025-02-06 17:48:09 -0800 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2025-02-14 19:58:14 -0800 |
commit | 4eb93fea59199c1aa6a6f837e90bdd597804cdcc (patch) | |
tree | 93087eca19676cf2e1ccdb32585694ef899e5a69 /kernel/bpf/bpf_struct_ops.c | |
parent | 06096d19ee3897a7e70922580159607fe315da7a (diff) |
selftests/bpf: add test for LDX/STX/ST relocations over array field
Add a simple repro for the issue of miscalculating LDX/STX/ST CO-RE
relocation size adjustment when the CO-RE relocation target type is an
ARRAY.
We need to make sure that compiler generates LDX/STX/ST instruction with
CO-RE relocation against entire ARRAY type, not ARRAY's element. With
the code pattern in selftest, we get this:
59: 61 71 00 00 00 00 00 00 w1 = *(u32 *)(r7 + 0x0)
00000000000001d8: CO-RE <byte_off> [5] struct core_reloc_arrays::a (0:0)
Where offset of `int a[5]` is embedded (through CO-RE relocation) into memory
load instruction itself.
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/r/20250207014809.1573841-2-andrii@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'kernel/bpf/bpf_struct_ops.c')
0 files changed, 0 insertions, 0 deletions