aboutsummaryrefslogtreecommitdiff
path: root/include/memory.h
diff options
context:
space:
mode:
authorKyle Evans <kevans@FreeBSD.org>2024-03-15 01:19:18 +0000
committerGordon Tetlow <gordon@FreeBSD.org>2024-03-28 03:12:41 +0000
commit56be7cd84447d9bc18b5b9e467eb976044194bbe (patch)
tree1345edb3210d491af516138295612a5f4b7ff839 /include/memory.h
parenta3ec3054762f0e7bf2381a7939e62c5e43fde935 (diff)
if_wg: use proper barriers around pkt->p_state
Without appropriate load-synchronization to pair with store barriers in wg_encrypt() and wg_decrypt(), the compiler and hardware are often allowed to reorder these loads in wg_deliver_out() and wg_deliver_in() such that we end up with a garbage or intermediate mbuf that we try to pass on. The issue is particularly prevalent with the weaker memory models of !x86 platforms. Switch from the big-hammer wmb() to more explicit acq/rel atomics to both make it obvious what we're syncing up with, and to avoid somewhat hefty fences on platforms that don't necessarily need this. With this patch, my dual-iperf3 reproducer is dramatically more stable than it is without on aarch64. PR: 264115 Reviewed by: andrew, zlei Approved by: so Security: FreeBSD-EN-24:06.wireguard (cherry picked from commit 3705d679a6344c957cae7a1b6372a8bfb8c44f0e) (cherry picked from commit 590e02d3c088b220c19d53ce40a5aecc6fa099e4)
Diffstat (limited to 'include/memory.h')
0 files changed, 0 insertions, 0 deletions