Hi,
I have a struct like below:
struct bpf_flow_keys {
long src;
};
I'm initializing an array of it using structures like below:
struct bpf_flow_keys flow_mask_array[] = {
{.src = 5555},
{.src = 4444},
};
instead of initialize it one-by-one
struct bpf_flow_keys flow_mask_array[2];
flow_mask_array[0].src = 5555;
flow_mask_array[1].src = 4444;
However, the former fails the verifier due to
bpf_load_program() err=13
0: (bf) r6 = r1
1: (30) r0 = *(u8 *)skb[23]
2: (63) *(u32 *)(r10 -4) = r0
3: (18) r1 = 0x223f6000
5: (79) r2 = *(u64 *)(r1 +8)
R1 invalid mem access 'map_ptr'
I guess it tries to store "4444, 5555" at some memory location (3: r1
= 0x223f6000), and loads to stack (5: r2).
The latter case works OK. Is this a limitation of verifier/bpf loader?
The C code, failed BPF, and passed BPF:
https://gist.github.com/williamtu/070a29e2fa8a15e512f26ea4ea9cffeb
Thanks,
William
_______________________________________________
iovisor-dev mailing list
[email protected]
https://lists.iovisor.org/mailman/listinfo/iovisor-dev