From: "Björn Töpel" <bjorn.topel@gmail.com>
To: ast@kernel.org, daniel@iogearbox.net, netdev@vger.kernel.org
Cc: "Björn Töpel" <bjorn.topel@intel.com>,
magnus.karlsson@intel.com, magnus.karlsson@gmail.com,
bpf@vger.kernel.org, jonathan.lemon@gmail.com,
syzbot+c82697e3043781e08802@syzkaller.appspotmail.com,
hdanton@sina.com, i.maximets@samsung.com
Subject: [PATCH bpf-next 3/4] xsk: avoid store-tearing when assigning umem
Date: Thu, 22 Aug 2019 11:13:05 +0200 [thread overview]
Message-ID: <20190822091306.20581-4-bjorn.topel@gmail.com> (raw)
In-Reply-To: <20190822091306.20581-1-bjorn.topel@gmail.com>
From: Björn Töpel <bjorn.topel@intel.com>
The umem member of struct xdp_sock is read outside of the control
mutex, in the mmap implementation, and needs a WRITE_ONCE to avoid
potentional store-tearing.
Fixes: 423f38329d26 ("xsk: add umem fill queue support and mmap")
Signed-off-by: Björn Töpel <bjorn.topel@intel.com>
---
net/xdp/xsk.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c
index 31236e61069b..6dde1857ed52 100644
--- a/net/xdp/xsk.c
+++ b/net/xdp/xsk.c
@@ -718,7 +718,7 @@ static int xsk_setsockopt(struct socket *sock, int level, int optname,
/* Make sure umem is ready before it can be seen by others */
smp_wmb();
- xs->umem = umem;
+ WRITE_ONCE(xs->umem, umem);
mutex_unlock(&xs->mutex);
return 0;
}
--
2.20.1
next prev parent reply other threads:[~2019-08-22 9:13 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Björn Töpel [this message]
2019-08-23 16:44 ` [PATCH bpf-next 3/4] xsk: avoid store-tearing when assigning umem 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190822091306.20581-4-bjorn.topel@gmail.com \
--to=bjorn.topel@gmail.com \
--cc=ast@kernel.org \
--cc=bjorn.topel@intel.com \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=hdanton@sina.com \
--cc=i.maximets@samsung.com \
--cc=jonathan.lemon@gmail.com \
--cc=magnus.karlsson@gmail.com \
--cc=magnus.karlsson@intel.com \
--cc=netdev@vger.kernel.org \
--cc=syzbot+c82697e3043781e08802@syzkaller.appspotmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox