Re: [PATCH 0/2] fix vma->anon_vma check for per-VMA locking; fix anon_vma memory ordering

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jul 27, 2023 at 10:11:29AM -0700, Linus Torvalds wrote:
> On Thu, 27 Jul 2023 at 08:44, Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> wrote:
> >
> > This reads a little oddly, perhaps because it's a fragment from a larger
> > piece of code.
> 
> Yes. As Jann already said, this is basically a preparatory step in a
> much longer sequence, and the code simply wants to make sure that any
> later code (possibly quite a bit later) will not see a NULL value.

...

> Do we even have the same-location rule in the LKMM?

Yes.  The comment in the source file calls it "Sequential Consistency 
Per Variable", under the category of "Fundamental coherence ordering".  
It applies even to plain accesses, not just to READ_ONCE or stronger.

But in the presence of data races (as in the example that Will posted 
earlier), all bets are off.  So if you want to use a plain access rather 
than READ_ONCE, you need to be certain that it won't race with anything.

Alan Stern




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux