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+55aFysA72FVTF6k=HnqYjCTqXQO+jcMLeR6MpM=eJm-H+EBQ@mail.gmail.com>
Date:	Sat, 2 Jun 2012 12:59:03 -0700
From:	Linus Torvalds <torvalds@...ux-foundation.org>
To:	Eric Dumazet <eric.dumazet@...il.com>
Cc:	Alan Cox <alan@...rguk.ukuu.org.uk>,
	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 11:38 AM, Linus Torvalds
<torvalds@...ux-foundation.org> wrote:
>
> I'm pretty sure this is the bug. And there's no way we can make
> 'tty_mutex' protect every tty_kref_put(). So I think we have two
> options:
>
>  - revert all the tty locking changes
>
>  - make a new global lock that protects just driver->ops->lookup(),
> driver->ttys[idx], and driver->ops->remove()
>
> Hmm?

Ok, here's the second option. THIS PATCH IS TOTALLY UNTESTED!

Basic concepts:

 - the tty driver lookup is protected with "tty_lookup_mutex",
similarly to how the "current task mutex" is protected by the signal
lock.

 - At lookup, we now always increment the kref (which in the case of
tty_open_current_tty() means that we do *not* drop the kref), and in
the case of a tty driver lookup, we use "atomic_inc_not_zero()" to
make sure that we get a tty that is not on its way out.

I *think* this makes sense. But it has has had absolutely zero
testing. It compiles in my config, and the locking is at least
sensible and well-localized, but maybe I'm missing something.

Comments?

                  Linus

Download attachment "tty-lookup-locking.patch" of type "application/octet-stream" (4054 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ