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]
Message-ID: <20100819222559.GW10429@dastard>
Date:	Fri, 20 Aug 2010 08:25:59 +1000
From:	Dave Chinner <david@...morbit.com>
To:	Jan Kara <jack@...e.cz>
Cc:	linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
	npiggin@...nel.dk, a.p.zijlstra@...llo.nl
Subject: Re: [bug] radix_tree_gang_lookup_tag_slot() looping endlessly

On Thu, Aug 19, 2010 at 05:58:39PM +0200, Jan Kara wrote:
>   Hi Dave,
> 
> On Thu 19-08-10 23:25:52, Dave Chinner wrote:
> > It looks to me like radix_tree_set_tag_if_tagged() is fundamentally
> > broken.  All the tag set/clear code stores the tree path in a cursor
> > and uses that to propagate the tags if and only if the full path
> > from root to leaf is resolved. radix_tree_set_tag_if_tagged() sets
> > tags on intermediate nodes before it has resolved the full path and
> > hence can set tags when it should not. The "should not" cases occur
> > when we have to tag sub-ranges or the scan aborts because it's
> > reached the number ot tag in a batch.
>   Thanks for debugging this! You are right that the code can leave dangling
> tag when we end the scan at the end of given range but the first tagged
> leaf is after the end of the given range (there shouldn't be a problem with
> the batches because there we can exit only just after we tag a leaf so that
> should be OK).
>   There are two possibilities how to fix the bug:
> a) Always tag bottom up - i.e., when we see leaf that should be tagged, go
> up and tag the parent as well if it is not already tagged.
> b) When we exit the search and we didn't not set any leaf tag since last
> time we went down, we walk up the tree and do an equivalent of
> radix_tree_clear_tag().
>   I'll probably go for a) since it looks more robust but b) would be
> probably faster.

I think that when it comes to data integrity, more robust should
win over speed every time. I think it can be done quite easily,
though, having slept on it - we have the current path in the
open_slots[] array, so we could just walk that when we set a leaf
tag. That should be easy to optimise as well - just keep track of
how high up the path we have set the tag and only walk that far
when setting the tags. That way we don't continually set the tag on
the root higher level slots. That shouldn't be any slower than the
current code...

Cheers,

Dave.
-- 
Dave Chinner
david@...morbit.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ