bpf: Ringbuf: Ensure we acquire load the length for the ring buf entry

The kernel updates the length with xchg() which does a memory barrier,
on the kernel side when the data is actually committed to the ring
buffer [1].

On the user space side the volatile is not sufficient to prevent the
data read from being reordered  before the load of length.


[1]https://github.com/torvalds/linux/blob/a20971c187522f5a7cd8e961e7e9c88f31ea2bed/kernel/bpf/ringbuf.c#L484

Bug: 374722456
Bug: 368624834
Bug: 376536942
Change-Id: I75eee3deee2afce83c1b760e6df383375f926ebb
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
1 file changed