Closed qsr closed 5 months ago
Good point. I think only the CMPXCHG is supposed to do that per the IETF BPF ISA doc.
Thanks for catching this. The issue is that the test was setting %r0 to 0 at the start of the test and then checking that it was zero to determine success. If the first check fails, it would exit early, leaving %r0 as 0, marking it as passed. The fix is to set %r0 to 1 (or any non-zero value at the start).
Both xchg tests check that the value is store in r0 after the atomic exchange. I cannot see any place in the ebpf spec that implies this. The value is supposed to be exchange with the src register.