On Mon, Dec 16, 2024 at 03:24:01PM -0800, Andrii Nakryiko wrote:
On Fri, Dec 13, 2024 at 7:13 PM Eduard Zingerman eddyz87@gmail.com wrote:
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.
+1, something like that where for big-endian it will be all zero while for little endian it would be 0xf (and then make sure that the test should *fail* by making sure that 0xf is not a valid index, so NULL check is necessary)
How would it work for LE to be 0xF but BE to be 0x0?
The prog passes a pointer to the beginning of the u32 to bpf_map_lookup_elem(). The kernel does a 4 byte read starting from that address. On both BE and LE all 4 bytes will be interpreted. So set bits cannot just go away.
Am I missing something?
Thanks, Daniel