On Fri, Dec 4, 2020 at 6:23 AM David Marcinkovic <david.marcinkovic@xxxxxxxxxx> wrote: > > On Thu, Dec 3, 2020 at 9:35 PM Andrii Nakryiko > <andrii.nakryiko@xxxxxxxxx> wrote: > > > > On Thu, Dec 3, 2020 at 4:20 AM David Marcinkovic > > <david.marcinkovic@xxxxxxxxxx> wrote: > > > > > > Hello everyone, > > > > > > I am trying to run a simple BPF program that hooks onto > > > `mac80211/drv_sta_state` tracepoint. When I run the program on the arm > > > 32 bit architecture, > > > the verifier rejects to load the program and outputs the following error > > > message: > > > > > > Unrecognized arg#0 type PTR > > > ; int tp__mac80211_drv_sta_state(struct trace_event_raw_drv_sta_state* ctx) > > > 0: (bf) r3 = r1 > > > 1: (85) call unknown#195896080 > > > invalid func unknown#195896080 > > > > > > This error does not seem to occur on the amd64 architecture. I am > > > using clang version 10 for both, compiling on amd64 and > > > cross-compiling for arm32. > > > > > > > > > I have prepared a simple program that hooks onto the > > > `mac80211/drv_sta_state` tracepoint. > > > In this example, `BPF_CORE_READ` macro function seems to cause the > > > verifier to reject to load the program. > > > I've been using this macro in various different programs and it didn't > > > cause any problems. > > > Also, I've been using packed structs and bit fields in other programs > > > and they also didn't cause any problems. > > > > > > I tried to use BPF_CORE_READ_BITFIELD as stated in this patch [0] and > > > got a similar error. > > > > > > Any input is much appreciated, > > > > > > > Can you provide libbpf debug output, especially the section about > > CO-RE relocations? Could it be that this tracepoint is inside the > > kernel module? > > You're right. The problem is that this tracepoint is inside the kernel module. > I recompiled the kernel with CONFIG_MAC80211 flag set to 'y' and the > program loads > successfully. > Ok, just as I suspected. With [0] and [1] (and using pahole 1.19+ to build the kernel and modules), it should work even for modules now. [0] https://patchwork.kernel.org/project/netdevbpf/list/?series=395715&state=* [1] https://patchwork.kernel.org/project/netdevbpf/list/?series=380759&state=* > Thank you very much for your fast reply. > > > > > > Best regards, > > > David Marčinković > > > > > > > > > [0] https://lore.kernel.org/bpf/20201007202946.3684483-1-andrii@xxxxxxxxxx/T/#ma08db511daa0b5978f16df9f98f4ef644b83fc96 > > > > > > > > > > [...]