On Tue, May 14, 2024 at 10:06 PM Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote: > > On Tue, 14 May 2024 at 20:32, Linus Torvalds > <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote: > > > > Why does it do that disgusting > > > > struct bpf_array *array = container_of(map, struct bpf_array, map); > > ... > > *insn++ = BPF_ALU32_IMM(BPF_AND, BPF_REG_0, array->index_mask); > > > > thing? As far as I can tell, a bpf map can be embedded in many > > different structures, not just that 'bpf_array' thing. > > Bah. It still needs to do that array->elem_size, so it's not just the > spectre-v1 code that needs that 'bpf_array' thing. > > And the non-percpu case seems to do all the same contortions, so I > don't know why the new percpu array would show issues. There is a special check for non-percpu arrays (ops == &array_map_ops check), which was missed and not updated for percpu arrays, unfortunately. I've added more map-in-map combinations to our tests so this can be caught sooner. Good thing Jakub tested in our production setup so we could catch this sooner! > > Oh well. I guess the bpf people will figure it out once they come back > from "partying at LSFMM" as you put it. Not much partying today, but the day was still quite hectic, sorry for delays. Just sent out the fix (rebased on top of the latest net-next/main). > > Linus >