lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Thu, 21 Apr 2022 10:14:54 -0300
From:   Jason Gunthorpe <jgg@...dia.com>
To:     Andrew Morton <akpm@...ux-foundation.org>
Cc:     Alistair Popple <apopple@...dia.com>, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org, christian.koenig@....com,
        jhubbard@...dia.com, rcampbell@...dia.com
Subject: Re: [PATCH v2] mm/mmu_notifier.c: Fix race in
 mmu_interval_notifier_remove()

On Wed, Apr 20, 2022 at 03:11:42PM -0700, Andrew Morton wrote:
> On Wed, 20 Apr 2022 14:37:34 +1000 Alistair Popple <apopple@...dia.com> wrote:
> 
> > In some cases it is possible for mmu_interval_notifier_remove() to race
> > with mn_tree_inv_end() allowing it to return while the notifier data
> > structure is still in use. Consider the following sequence:
> > 
> > CPU0 - mn_tree_inv_end()            CPU1 - mmu_interval_notifier_remove()
> >                                     spin_lock(subscriptions->lock);
> >                                     seq = subscriptions->invalidate_seq;
> > spin_lock(subscriptions->lock);     spin_unlock(subscriptions->lock);
> > subscriptions->invalidate_seq++;
> >                                     wait_event(invalidate_seq != seq);
> >                                     return;
> > interval_tree_remove(interval_sub); kfree(interval_sub);
> > spin_unlock(subscriptions->lock);
> > wake_up_all();
> > 
> > As the wait_event() condition is true it will return immediately. This
> > can lead to use-after-free type errors if the caller frees the data
> > structure containing the interval notifier subscription while it is
> > still on a deferred list. Fix this by taking the appropriate lock when
> > reading invalidate_seq to ensure proper synchronisation.
> > 
> > ...
> >
> > Fixes: 99cb252f5e68 ("mm/mmu_notifier: add an interval tree notifier")
> 
> Do you think fix this should be backported into older kernels?

I think it should be tagged stable, yes

Jason

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ