On Mon, Sep 18, 2017 at 11:14 AM, Paul Chaignon
<[email protected]> wrote:
>> > +                   BPF_ALU64_IMM(BPF_ADD, BPF_REG_2,
>> > +                                 offsetof(struct test_val, foo)),
>>
>> there are few bugs here.
>> 1. it adds 4 byte, so it should have been rejected as misaligned.
>
> I've fixed the other bugs, but I don't understand that one. Don't all
> map helpers assume byte aligned pointers? Even without this patch, map
> helper accesses to misaligned pointers are accepted if we first copy
> the value on the stack.

that is a bit of grey territory unfortunately which we need to
document and audit the verifier.
Most map helpers don't take advantage of key/value alignment
constraint, but pcpu maps, lpm maps already require
both key and value to be aligned.
Ex: bpf_long_memcpy() and trie_lookup_elem().
_______________________________________________
iovisor-dev mailing list
[email protected]
https://lists.iovisor.org/mailman/listinfo/iovisor-dev

Reply via email to