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]
Date:	Thu, 31 May 2012 13:45:47 +0200 (CEST)
From:	Jiri Kosina <jkosina@...e.cz>
To:	Eric Dumazet <eric.dumazet@...il.com>
Cc:	Alan Cox <alan@...ux.intel.com>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Jens Axboe <jaxboe@...ionio.com>
Subject: Re: [PATCH] tty: add lockdep annotations

On Thu, 31 May 2012, Eric Dumazet wrote:

> From: Eric Dumazet <edumazet@...gle.com>
> 
> tty_lock_pair() do the right thing to avoid deadlocks, but should
> instruct LOCKDEP of this to avoid a splat. 

I have submitted very similar patch to Greg/Alan already 3 days ago[1], 
but have been told that this is already fixed. Apparently it wasn't?

[1] https://lkml.org/lkml/2012/5/28/226

> 
> Signed-off-by: Eric Dumazet <edumazet@...gle.com>
> ---
> Latest Linus tree still hang on my machine, at least this patch removes
> the lockdep problem...
> 
>  drivers/tty/tty_mutex.c |   19 +++++++++++++++----
>  1 file changed, 15 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/tty/tty_mutex.c b/drivers/tty/tty_mutex.c
> index 69adc80..67feac9 100644
> --- a/drivers/tty/tty_mutex.c
> +++ b/drivers/tty/tty_mutex.c
> @@ -6,11 +6,17 @@
>  
>  /* Legacy tty mutex glue */
>  
> +enum {
> +	TTY_MUTEX_NORMAL,
> +	TTY_MUTEX_NESTED,
> +};
> +
>  /*
>   * Getting the big tty mutex.
>   */
>  
> -void __lockfunc tty_lock(struct tty_struct *tty)
> +static void __lockfunc tty_lock_nested(struct tty_struct *tty,
> +				       unsigned int subclass)
>  {
>  	if (tty->magic != TTY_MAGIC) {
>  		printk(KERN_ERR "L Bad %p\n", tty);
> @@ -18,7 +24,12 @@ void __lockfunc tty_lock(struct tty_struct *tty)
>  		return;
>  	}
>  	tty_kref_get(tty);
> -	mutex_lock(&tty->legacy_mutex);
> +	mutex_lock_nested(&tty->legacy_mutex, subclass);
> +}
> +
> +void __lockfunc tty_lock(struct tty_struct *tty)
> +{
> +	return tty_lock_nested(tty, TTY_MUTEX_NORMAL);
>  }
>  EXPORT_SYMBOL(tty_lock);
>  
> @@ -43,11 +54,11 @@ void __lockfunc tty_lock_pair(struct tty_struct *tty,
>  {
>  	if (tty < tty2) {
>  		tty_lock(tty);
> -		tty_lock(tty2);
> +		tty_lock_nested(tty2, TTY_MUTEX_NESTED);
>  	} else {
>  		if (tty2 && tty2 != tty)
>  			tty_lock(tty2);
> -		tty_lock(tty);
> +		tty_lock_nested(tty, TTY_MUTEX_NESTED);
>  	}
>  }
>  EXPORT_SYMBOL(tty_lock_pair);
> 
> 
> --
> 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/
> 

-- 
Jiri Kosina
SUSE Labs

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