Re: [PATCH] mm: fix the race on huge alloc failed
From: Guilherme Giacomo Simoes
Date: Tue Sep 01 2026 - 07:57:16 EST
First, thanks Lorenzo to help me with this...
"Lorenzo Stoakes (ARM)" <ljs@xxxxxxxxxx> wrote:
> > > > I don't think it's enough to just add a data_race() to this one read of
> > > > vma->anon_vma. I think it's quite prevalent. There's probably other
> > > > syzbot reports that mention it.
> >
> > It sounds to me like the most cromulent solution is simply adding a
> >
> > /* maybe vma_has_anon? */
> > static inline bool vma_has_anon_vma(const struct vm_area_struct *vma)
> > {
> > return data_race(vma->anon_vma);
> > }
> >
> > and churn everything to use it.
>
> I'd prefer vma_is_faulted(). That'll align better with my scalable CoW work
> also.
>
> Anyway I agree with Pedro that a data_race() resolution is appropriate here
> rather than an unnecessary READ_ONCE()/WRITE_ONCE() pair.
Okay, if only a data_race(...) is enough to silently KCSAN, I can send a new
PATCH or send a v2 of this PATCH with this new implementation and with a fix of
commit message