On Tue, 27 Jan 2026 10:13:53 -0800 [email protected] wrote: > From: Scott Mitchell <[email protected]> > > The AF_PACKET driver had multiple correctness issues that could > cause data races and memory corruption in multi-threaded environments. > > Thread Safety Issues: > > 1. Statistics counters (rx_pkts, tx_pkts, rx_bytes, tx_bytes, etc.) > were declared as 'volatile unsigned long' which provides no > atomicity guarantees and can cause torn reads/writes on 32-bit > platforms or when the compiler uses multiple instructions.
This is bad idea Atomic is even more expensive and only one thread should be updating at a time. If you want to handle 32 bit platforms then something like the Linux kernel mechanism for stats is needed. It does: - on 32 bit platforms does a multiple read look (like seqlock) - on 64 bit platforms is just regular operations.

