Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752819AbdLHSI6 (ORCPT ); Fri, 8 Dec 2017 13:08:58 -0500 Received: from shards.monkeyblade.net ([184.105.139.130]:56694 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750954AbdLHSIy (ORCPT ); Fri, 8 Dec 2017 13:08:54 -0500 Date: Fri, 08 Dec 2017 13:08:48 -0500 (EST) Message-Id: <20171208.130848.1881550210595407116.davem@davemloft.net> To: mst@redhat.com 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 Subject: Re: [PATCH] ptr_ring: add barriers From: David Miller In-Reply-To: <1512501990-30029-1-git-send-email-mst@redhat.com> References: <1512501990-30029-1-git-send-email-mst@redhat.com> X-Mailer: Mew version 6.7 on Emacs 25.3 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Fri, 08 Dec 2017 10:08:51 -0800 (PST) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1044 Lines: 30 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 > --- > > George, could you pls report whether this patch fixes > the issue for you? > > This seems to be needed in stable as well. I really need some testing feedback for this before I apply it and queue it up for -stable. George?