On Mon, Sep 7, 2020 at 5:18 AM David Marcinkovic <david.marcinkovic@xxxxxxxxxx> wrote: > > Hello everyone, > > I am trying to run a simple BPF example that uses the > `__sync_fetch_and_add` built-in function for atomic memory access. It > fails with `libbpf: load bpf program failed: ERROR: > strerror_r(524)=22` error message. > > 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 am aware that those built-in functions are available for arm32. [0]. > Why is this error occurring? > Seems like BPF JIT for arm32 doesn't yet support those atomic operations, see [0] [0] https://github.com/torvalds/linux/blob/master/arch/arm/net/bpf_jit_32.c#L1627 You might want to try running in interpreted mode and see if that works for you. You'll lose speed, but will get functionality you need. > To demonstrate I have prepared one simple example program that uses > that built-in function for atomic memory access. > > Any input is much appreciated, > > Best regards, > David Marčinković > > [0] https://developer.arm.com/documentation/dui0491/c/compiler-specific-features/gnu-builtin-functions?lang=en > [...]