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: <20081031153539.GH18182@logfs.org>
Date:	Fri, 31 Oct 2008 16:35:40 +0100
From:	Jörn Engel <joern@...fs.org>
To:	Tim Gardner <tcanonical@....com>
Cc:	Johannes Berg <johannes@...solutions.net>,
	linux-kernel@...r.kernel.org
Subject: Re: [RFC] B+Tree library

On Fri, 31 October 2008 09:18:06 -0600, Tim Gardner wrote:
> Johannes Berg wrote:
> >> +static inline size_t btree_visitorl(struct btree_headl *head, long opaque,
> >> +		visitorl_t func2)
> >> +{
> >> +	return btree_visitor(&head->h, &btree_geo32, opaque, visitorl, func2);
> >> +}
> > 
> > Incidentally, do you think it would be possible to implement a kind of 
> > 
> > btree_for_each_entry(e, ...) {
> > 	do something with e
> > }
> > 
> > macro or function/macro combination? You seem to be doing a recursive
> > walk across the tree, would it be useful to have a linked list at the
> > lowest level of nodes to be able to iterate more easily?
> 
> What would you expect to be the behavior if you remove 'e' ? That might
> cause the tree to get re-ordered. Do you restart the list traversal?

BUG(), if you're lucky.  Silent data corruption, if you're not so lucky.

The btree_grim_visitor() exists to remove all element after being handed
to the visitor.  btree_visitor() removes none.  Either function requires
the caller to do proper locking.  Calling two functions from two threads
in parallel or calling a function from the visitor callback will give
you undefined results - with the exception of parallel lookups, which
are obviously fine.

Jörn

-- 
Beware of bugs in the above code; I have only proved it correct, but
not tried it.
-- Donald Knuth
--
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