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: <CA+55aFwPdYfu5p5EPqZLnzps0v0+MaL7=dr9cK71EqhAL-Hebg@mail.gmail.com>
Date:	Sat, 2 Jun 2012 18:37:47 -0700
From:	Linus Torvalds <torvalds@...ux-foundation.org>
To:	Alan Cox <alan@...rguk.ukuu.org.uk>
Cc:	Eric Dumazet <eric.dumazet@...il.com>,
	Alan Cox <alan@...ux.intel.com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Jens Axboe <jaxboe@...ionio.com>
Subject: Re: [PATCH] tty: add lockdep annotations

On Sat, Jun 2, 2012 at 3:25 PM, Linus Torvalds
<torvalds@...ux-foundation.org> wrote:
>
> Hmm. Ok. Looking at it, the ".shutdown" and ".remove" functions are
> all very limited, so I suspect we could just make the rule be that the
> install/lookup functions are serialized against each other by the
> pty_mutex (true today), and then we just add a small spinlock for the
> actual driver array insert/lookup.

Actually, I think we could probably make it really trivial by forcing
the free'ing of the tty itself to be RCU-delayed.

Then shutdown/remove would remove the entry with no locking
what-so-ever (which is really nice if you're in an interrupt - because
now *other* users don't need to use those annoying irq-safe versions),
and simply just clear the ttys[] array index.

The lookup side would need to just do a RCU read lock, read the
->ttys[index] thing using ACCESS_ONCE, and then just do the
atomic_inc_not_zero() dance I already did to validate that the thing
is still alive.

Voila - very cheap locking, and the part that could possibly happen
from interrupts (shutdown/remove) needs no locking at all.

Making the tty freeing be rcu-delayed sounds pretty dang simple too.

What do you think?

Anyway, I'm closing the merge window now (doing the tagging, booting
and checking that allmodconfig/allyesconfig/allnoconfigs all compile
fine) so it's 3.6 material, but it doesn't sound bad.

                Linus
--
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