BPF List
 help / color / mirror / Atom feed
* [PATCH bpf-next 0/4] xsk: various CPU barrier and {READ, WRITE}_ONCE fixes
@ 2019-08-22  9:13 Björn Töpel
  2019-08-22  9:13 ` [PATCH bpf-next 1/4] xsk: avoid store-tearing when assigning queues Björn Töpel
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Björn Töpel @ 2019-08-22  9:13 UTC (permalink / raw)
  To: ast, daniel, netdev
  Cc: Björn Töpel, magnus.karlsson, magnus.karlsson, bpf,
	bjorn.topel, jonathan.lemon, syzbot+c82697e3043781e08802, hdanton,
	i.maximets

This is a four patch series of various barrier, {READ, WRITE}_ONCE
cleanups in the AF_XDP socket code. More details can be found in the
corresponding commit message.

For an AF_XDP socket, most control plane operations are done under the
control mutex (struct xdp_sock, mutex), but there are some places
where members of the struct is read outside the control mutex. This,
as pointed out by Daniel in [1], requires proper {READ,
WRITE}_ONCE-correctness [2] [3]. To address this, and to simplify the
code, the state variable (introduced by Ilya), is now used a point of
synchronization ("is the socket in a valid state, or not").


Thanks,
Björn

[1] https://lore.kernel.org/bpf/beef16bb-a09b-40f1-7dd0-c323b4b89b17@iogearbox.net/
[2] https://lwn.net/Articles/793253/
[3] https://github.com/google/ktsan/wiki/READ_ONCE-and-WRITE_ONCE

Björn Töpel (4):
  xsk: avoid store-tearing when assigning queues
  xsk: add proper barriers and {READ, WRITE}_ONCE-correctness for state
  xsk: avoid store-tearing when assigning umem
  xsk: lock the control mutex in sock_diag interface

 net/xdp/xsk.c      | 61 ++++++++++++++++++++++++++++++++--------------
 net/xdp/xsk_diag.c |  3 +++
 2 files changed, 46 insertions(+), 18 deletions(-)

-- 
2.20.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2019-08-25 17:06 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-08-22  9:13 [PATCH bpf-next 0/4] xsk: various CPU barrier and {READ, WRITE}_ONCE fixes Björn Töpel
2019-08-22  9:13 ` [PATCH bpf-next 1/4] xsk: avoid store-tearing when assigning queues Björn Töpel
     [not found]   ` <5d5e980f.1c69fb81.f8d9b.71f2SMTPIN_ADDED_MISSING@mx.google.com>
2019-08-22 13:51     ` Björn Töpel
2019-08-23 16:43   ` Jonathan Lemon
2019-08-22  9:13 ` [PATCH bpf-next 2/4] xsk: add proper barriers and {READ, WRITE}_ONCE-correctness for state Björn Töpel
2019-08-23 16:46   ` Jonathan Lemon
2019-08-25 17:06     ` Björn Töpel
2019-08-22  9:13 ` [PATCH bpf-next 3/4] xsk: avoid store-tearing when assigning umem Björn Töpel
2019-08-23 16:44   ` Jonathan Lemon
2019-08-22  9:13 ` [PATCH bpf-next 4/4] xsk: lock the control mutex in sock_diag interface Björn Töpel
2019-08-23 16:44   ` Jonathan Lemon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox