From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Miller Subject: Re: [PATCH] ptr_ring: add barriers Date: Mon, 11 Dec 2017 10:53:08 -0500 (EST) Message-ID: <20171211.105308.1899676147655539775.davem@davemloft.net> References: <1512501990-30029-1-git-send-email-mst@redhat.com> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: linux-kernel@vger.kernel.org, george.cherian@cavium.com, jasowang@redhat.com, edumazet@google.com, netdev@vger.kernel.org, virtualization@lists.linux-foundation.org To: mst@redhat.com Return-path: Received: from shards.monkeyblade.net ([184.105.139.130]:35778 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751400AbdLKPxK (ORCPT ); Mon, 11 Dec 2017 10:53:10 -0500 In-Reply-To: <1512501990-30029-1-git-send-email-mst@redhat.com> Sender: netdev-owner@vger.kernel.org List-ID: From: "Michael S. Tsirkin" Date: Tue, 5 Dec 2017 21:29:37 +0200 > Users of ptr_ring expect that it's safe to give the > data structure a pointer and have it be available > to consumers, but that actually requires an smb_wmb > or a stronger barrier. > > In absence of such barriers and on architectures that reorder writes, > consumer might read an un=initialized value from an skb pointer stored > in the skb array. This was observed causing crashes. > > To fix, add memory barriers. The barrier we use is a wmb, the > assumption being that producers do not need to read the value so we do > not need to order these reads. > > Reported-by: George Cherian > Suggested-by: Jason Wang > Signed-off-by: Michael S. Tsirkin I'm asked for asking for testing feedback and did not get it in a reasonable amount of time. So I'm applying this as-is, and queueing it up for -stable. Thank you.