On Mon, Dec 4, 2023 at 10:34 AM Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote: > > So afaict this is used through bpf_for_each_map_elem(), where the > argument still is properly callback_fn. However, in the desriptor > bpf_for_each_map_elem_proto the argument gets described as: > ARG_PTR_TO_FUNC, which in turn has a comment like: > > ARG_PTR_TO_FUNC, /* pointer to a bpf program function */ > > Which to me sounds like there is definite type punning involved. The > call in bpf_for_each_array_elem() is a regular C indirect call, which > gets adorned with the kCFI magic. > > But I doubt the BPF function that gets used gets the correct matching > bits on. > > TL;DR, I think this is a pre-existing problem with kCFI + eBPF and not > caused by my patches. It is a pre-existing problem, I ran into the same failures when I looked into this briefly last year: https://github.com/ClangBuiltLinux/linux/issues/1727 In addition to bpf_for_each_array_elem, a few other callers also use the same function pointer type that doesn't match cfi_bpf_hash. Sami