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:	Mon, 3 Aug 2009 01:46:33 +0300
From:	Sergey Senozhatsky <sergey.senozhatsky@...l.by>
To:	Linus Torvalds <torvalds@...ux-foundation.org>
Cc:	OGAWA Hirofumi <hirofumi@...l.parknet.co.jp>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	Greg KH <greg@...ah.com>
Subject: Re: WARNING at: drivers/char/tty_ldisc.c

On (08/02/09 14:33), Linus Torvalds wrote:
> > And another related point which I'm don't know is why we don't change
> > console_fops to hung_up_tty_fops in do_tty_hangup() in the below.
> 
> Yup, you're right. Because console_fops has 
> 
>         .write          = redirected_tty_write,
> 
> we won't actually hang up the console due to that test for "write != 
> tty_write".
[...]
> So exactly what _does_ happen if we get rid of that hack?
> 
This solution looks like the right one. There is no trace
on shutdown.
I'll compile and test non-SMP kernel (and of course yet more testing for SMP).

	Sergey


>  drivers/char/tty_io.c |   19 +------------------
>  1 files changed, 1 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
> index a3afa0c..80540ec 100644
> --- a/drivers/char/tty_io.c
> +++ b/drivers/char/tty_io.c
> @@ -496,10 +496,8 @@ static void do_tty_hangup(struct work_struct *work)
>  {
>  	struct tty_struct *tty =
>  		container_of(work, struct tty_struct, hangup_work);
> -	struct file *cons_filp = NULL;
>  	struct file *filp, *f = NULL;
>  	struct task_struct *p;
> -	int    closecount = 0, n;
>  	unsigned long flags;
>  	int refs = 0;
>  
> @@ -520,11 +518,6 @@ static void do_tty_hangup(struct work_struct *work)
>  	file_list_lock();
>  	/* This breaks for file handles being sent over AF_UNIX sockets ? */
>  	list_for_each_entry(filp, &tty->tty_files, f_u.fu_list) {
> -		if (filp->f_op->write == redirected_tty_write)
> -			cons_filp = filp;
> -		if (filp->f_op->write != tty_write)
> -			continue;
> -		closecount++;
>  		tty_fasync(-1, filp, 0);	/* can't block */
>  		filp->f_op = &hung_up_tty_fops;
>  	}
> @@ -574,17 +567,7 @@ static void do_tty_hangup(struct work_struct *work)
>  	while (refs--)
>  		tty_kref_put(tty);
>  
> -	/*
> -	 * If one of the devices matches a console pointer, we
> -	 * cannot just call hangup() because that will cause
> -	 * tty->count and state->count to go out of sync.
> -	 * So we just call close() the right number of times.
> -	 */
> -	if (cons_filp) {
> -		if (tty->ops->close)
> -			for (n = 0; n < closecount; n++)
> -				tty->ops->close(tty, cons_filp);
> -	} else if (tty->ops->hangup)
> +	if (tty->ops->hangup)
>  		(tty->ops->hangup)(tty);
>  	/*
>  	 * We don't want to have driver/ldisc interactions beyond
> 

Download attachment "signature.asc" of type "application/pgp-signature" (316 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ