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: <20150415131309.GA21491@kroah.com>
Date:	Wed, 15 Apr 2015 15:13:09 +0200
From:	Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To:	Al Viro <viro@...IV.linux.org.uk>
Cc:	Jiri Kosina <jkosina@...e.cz>, Borislav Petkov <bp@...en8.de>,
	Andy Lutomirski <luto@...capital.net>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Arnd Bergmann <arnd@...db.de>,
	"Eric W. Biederman" <ebiederm@...ssion.com>,
	One Thousand Gnomes <gnomes@...rguk.ukuu.org.uk>,
	Tom Gundersen <teg@...m.no>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Daniel Mack <daniel@...que.org>,
	David Herrmann <dh.herrmann@...il.com>,
	Djalal Harouni <tixxdz@...ndz.org>
Subject: Re: [GIT PULL] kdbus for 4.1-rc1

On Wed, Apr 15, 2015 at 01:36:33PM +0100, Al Viro wrote:
> al@...e:~/linux/trees/vfs$ git grep -n -w kdbus_node_idr_lock
> ipc/kdbus/node.c:237:static DECLARE_RWSEM(kdbus_node_idr_lock);
> ipc/kdbus/node.c:340:   down_write(&kdbus_node_idr_lock);
> ipc/kdbus/node.c:344:   up_write(&kdbus_node_idr_lock);
> ipc/kdbus/node.c:444:           down_write(&kdbus_node_idr_lock);
> ipc/kdbus/node.c:452:           up_write(&kdbus_node_idr_lock);

Heh, that's a leftover from an older version, I'll go fix that up to be
a simple mutex, which is all that this is doing here anyway.

> Do you see anything wrong with that?  Or with things like that:
>                 mutex_lock(&pos->lock);
>                 v_pre = atomic_read(&pos->active);
>                 if (v_pre >= 0)
>                         atomic_add_return(KDBUS_NODE_BIAS, &pos->active);
>                 else if (v_pre == KDBUS_NODE_NEW)
>                         atomic_set(&pos->active, KDBUS_NODE_RELEASE_DIRECT);
>                 mutex_unlock(&pos->lock);
> What are the locking rules for ->active/->waitq/->lock?  Are those the
> outermost thing in the hierarchy?  Or is that dependent on the node location?
> It sure as hell is outside of (at least) ->mmap_sem (by way of
> kdbus_conn_connect() establishing that ->active/->waitq is outside of
> ->conn_rwlock, which due to kdbus_bus_broadcast() nests outside of anything
> taken by kdbus_meta_proc_collect(), which includes ->mmap_sem) and that alone
> brings in a lot...
> 
> Document your goddamn locking, would you?  It *IS* new code, and you, as you
> say, had very few people working on it, so you don't have the excuses for
> the mess existing in older parts of the tree.

Fair enough, documenting the locking is a good thing, that will make
reviewing this easier, I'll go work on that.

> Locking complexity in there is easily as bad as that of VFS sans the RCU fun;
> sure, I can spend a week and (hopefully) document it for you, but I would
> really prefer if you guys had done that.  And I *do* appreciate the comments
> in node.c, but they are nowhere near enough.

Thanks, it's hard to balance the comment/code level at times.  And yes,
it is complex and should be explained better, will work on that.

greg k-h
--
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