ebpf-verifier icon indicating copy to clipboard operation
ebpf-verifier copied to clipboard

Support for BPF_FETCH in atomic operations

Open xfoukas opened this issue 1 year ago • 3 comments

As far as I understand by looking at the following code https://github.com/vbpf/ebpf-verifier/blob/3ea1b73f68f3fff48afbd0508ca438c3b9a4d614/src/asm_unmarshal.cpp#L218 the verifier currently only supports BPF_ADD atomic operations, but does not support the BPF_FETCH modifier, as defined here: https://docs.kernel.org/bpf/instruction-set.html#atomic-operations

Is my understanding correct? Are there plans to add support for BPF_FETCH? This can be particularly useful for implementing critical sections.

xfoukas avatar Apr 12 '23 20:04 xfoukas

It is not supported yet, but I believe should be straight forward to implement - atomic arithmetic is largely not different from non-atomic, as far as the verifier is concerned.

elazarg avatar Apr 12 '23 21:04 elazarg

Is it possible to get an update on sync_fetch_and_add/lock_xadd support? It is needed for ebpf-for-windows.

shpalani avatar Aug 23 '23 04:08 shpalani

@shpalani asked:

Is it possible to get an update on sync_fetch_and_add/lock_xadd support? It is needed for ebpf-for-windows.

Ok, pull request is now ready for review.

dthaler avatar Jan 04 '24 19:01 dthaler