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] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 6 Jul 2018 16:36:41 +0100
From:   Mark Rutland <mark.rutland@....com>
To:     Matthew Wilcox <willy@...radead.org>
Cc:     linux-kernel@...r.kernel.org,
        Andrew Morton <akpm@...ux-foundation.org>,
        Matthew Wilcox <mawilcox@...rosoft.com>,
        valdis.kletnieks@...edu
Subject: Re: [PATCH] radix-tree: avoid NULL dereference

On Fri, Jul 06, 2018 at 03:36:04PM +0100, Mark Rutland wrote:
> On Fri, Jul 06, 2018 at 07:25:40AM -0700, Matthew Wilcox wrote:
> > On Fri, Jul 06, 2018 at 02:41:44PM +0100, Mark Rutland wrote:
> > > When idr_alloc() is called for the first time on an IDR (which has no
> > > nodes in its radix tree), we end up with calculate_count() calling
> > > get_slot_offset() with a NULL node, leading to a NULL pointer
> > > dereference caught by UBSAN:
> > 
> > Thanks!
> > 
> > > The result of the load is passed into node_tag_get(), which ignores the
> > > value when node is NULL. Typically, the compiler inlines both
> > > get_slot_offset() and node_tag_get() into calculate_count(), optimizing
> > > away the NULL-pointer dereference, and hence this doesn't typically
> > > result in a boot failure.
> > > 
> > > We can't rely on the compiler always doing this, and must avoid
> > > dereferencing fields from node when it is potentially NULL.
> > > 
> > > To do so, this patch folds the generation of offset into tag_get(), such
> > > that this only happens when node is not NULL. Callers are updated to
> > > pass the relevant slot, rather than the offset derived from it.
> > 
> > I did think about this ... honest!  My reasoning clearly glitched at some
> > point.  I think this is the right way to fix the problem.
> > 
> > Acked-by: Matthew Wilcox <willy@...radead.org>
> 
> Cheers!
> 
> I assume that Andrew will pick this up, if he's also happy with it.

I've just started fuzzing, and found this also applies with
node_tag_set(). I'll spin a v2 with that fixed up, too.

Thanks,
Mark.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ