From: Jason Wang Subject: Re: [PATCH net-next 05/12] ptr_ring: disallow lockless __ptr_ring_full Date: Mon, 29 Jan 2018 11:36:09 +0800 Message-ID: <2c1b1348-08b3-a8b3-5d59-37db6257cda9@redhat.com> References: <1516923320-16959-1-git-send-email-mst@redhat.com> <1516923320-16959-6-git-send-email-mst@redhat.com> <4bd89514-062c-dadf-53db-e6fac59512b1@redhat.com> <20180126044421-mutt-send-email-mst@kernel.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, John Fastabend , David Miller To: "Michael S. Tsirkin" Return-path: In-Reply-To: <20180126044421-mutt-send-email-mst@kernel.org> Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org List-Id: netdev.vger.kernel.org On 2018年01月26日 10:46, Michael S. Tsirkin wrote: >> On 2018年01月26日 07:36, Michael S. Tsirkin wrote: >>> Similar to bcecb4bbf88a ("net: ptr_ring: otherwise safe empty checks can >>> overrun array bounds") a lockless use of __ptr_ring_full might >>> cause an out of bounds access. >>> >>> We can fix this, but it's easier to just disallow lockless >>> __ptr_ring_full for now. >> It looks to me that just fix this is better than disallow through doc (which >> is easily to be ignored ...). >> >> Thanks > lockless is tricky, and I'd rather not sprinkle READ/WRITE_ONCE where > they aren't necessary. > The problem is then API looks a little bit strange. Lockless were only allowed to be done at __ptr_ring_empty() but not __ptr_ring_full(). Thanks