lkml.org 
[lkml]   [2018]   [Jan]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH net-next 05/12] ptr_ring: disallow lockless __ptr_ring_full
On Mon, Jan 29, 2018 at 11:36:09AM +0800, Jason Wang wrote:
>
>
> 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

So __ptr_ring_empty doesn't really work lockless. It merely does not crash.
I don't believe we can do anything to remove the need to read the
docs unless people use the safe non __ variants.

--
MST

\
 
 \ /
  Last update: 2018-01-29 05:42    [W:0.147 / U:2.380 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site