Re: [PATCH bpf-next v5 4/5] bpf: verifier: Support eliding map lookup nullness
From: Eduard Zingerman
Date: Fri Dec 13 2024 - 22:13:24 EST
On Fri, 2024-12-13 at 19:44 -0700, Daniel Xu wrote:
[...]
> > > + /* First handle precisely tracked STACK_ZERO, up to BPF_REG_SIZE */
> > > + stype = state->stack[spi].slot_type;
> > > + for (i = 0; i < BPF_REG_SIZE && stype[i] == STACK_ZERO; i++)
> >
> > it's Friday and I'm lazy, but please double-check that this works for
> > both big-endian and little-endian :)
>
> Any tips? Are the existing tests running thru s390x hosts in CI
> sufficient or should I add some tests writen in C (and not BPF
> assembler)? I can never think about endianness correctly...
I think that if test operates on a key like:
valid key 15
v
0000000f <-- written to stack as a single u64 value
^^^^^^^
stack zero marks
and is executed (e.g. using __retval annotation),
then CI passing for s390 should be enough.
There is a guide on how to gen a s390 environment locally:
https://docs.kernel.org/bpf/s390.html
I used it recently to build a vmlinux for s390 with no or minimal
issues. Used it to boot long time ago, but don't remember if there
were any surprises.
> > with Eduard's suggestion this also becomes interesting when you have
> > 000mmm mix (as one example), because that gives you a small range, and
> > all values might be valid keys for arrays
>
> Can you define what "small range" means? What range is there with 0's?
> Any pointers would be helpful.
I think Andrii means that each 'm' adds 8 bits of range.
E.g. range for 0000_000m is 0-255, range for 0000_00mm is 0-65535, etc.
[...]