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]
Message-ID: <20170118163746.GA32495@cmpxchg.org>
Date:   Wed, 18 Jan 2017 11:37:46 -0500
From:   Johannes Weiner <hannes@...xchg.org>
To:     Matthew Wilcox <mawilcox@...rosoft.com>
Cc:     Matthew Wilcox <mawilcox@...uxonhyperv.com>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] radix-tree: Fix private list warnings

On Sat, Jan 14, 2017 at 07:57:51PM -0500, Johannes Weiner wrote:
> On Sat, Jan 14, 2017 at 09:31:51PM +0000, Matthew Wilcox wrote:
> > From: Johannes Weiner [mailto:hannes@...xchg.org]
> > > On Thu, Jan 12, 2017 at 05:28:23PM -0800, Matthew Wilcox wrote:
> > > > The newly introduced warning in radix_tree_free_nodes() was testing the
> > > > wrong variable; it should have been 'old' instead of 'node'.  Rather
> > > > than replace that one instance, I noticed that we can simply put the
> > > > WARN_ON_ONCE in radix_tree_node_free() and it will be just as effective.
> > > >
> > > > Fixes: ea07b862ac8e ("mm: workingset: fix use-after-free in shadow node
> > > shrinker")
> > > > Signed-off-by: Matthew Wilcox <mawilcox@...rosoft.com>
> > > 
> > > Thanks for the fix in radix_tree_free_nodes(). But I intentionally
> > > spread out the warnings to retain the line numbers. The inlining in
> > > that code will obscure which tree operation ends up triggering.
> > 
> > The backtrace should make that fairly obvious though; even if
> > radix_tree_node_free() gets inlined, the caller of
> > radix_tree_free_nodes() probably doesn't also call
> > radix_tree_shrink() or delete_node().  You're really looking for the
> > caller in the backtrace that's outside of radix-tree.c.
> 
> Distinguishing between the radix_tree_shrink() and the delete_node()
> sites was essential to find the bug whose fix added these warnings.
> The former gets inlined into the latter. Not impossible to figure out
> which one triggered from a full dump, but certainly less robust.

This?

>From 669b5ed6e32386d634023fee29b0b8562951e734 Mon Sep 17 00:00:00 2001
From: Matthew Wilcox <mawilcox@...rosoft.com>
Date: Thu, 12 Jan 2017 17:28:23 -0800
Subject: [PATCH] radix-tree: Fix private list warnings

The newly introduced warning in radix_tree_free_nodes() was testing the
wrong variable; it should have been 'old' instead of 'node'.

Fixes: ea07b862ac8e ("mm: workingset: fix use-after-free in shadow node shrinker")
Signed-off-by: Matthew Wilcox <mawilcox@...rosoft.com>
Signed-off-by: Johannes Weiner <hannes@...xchg.org>
---
 lib/radix-tree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/radix-tree.c b/lib/radix-tree.c
index 0b92d605fb69..84812a9fb16f 100644
--- a/lib/radix-tree.c
+++ b/lib/radix-tree.c
@@ -769,7 +769,7 @@ static void radix_tree_free_nodes(struct radix_tree_node *node)
 			struct radix_tree_node *old = child;
 			offset = child->offset + 1;
 			child = child->parent;
-			WARN_ON_ONCE(!list_empty(&node->private_list));
+			WARN_ON_ONCE(!list_empty(&old->private_list));
 			radix_tree_node_free(old);
 			if (old == entry_to_node(node))
 				return;
-- 
2.11.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ