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: <1160828425.15683.16.camel@laptopd505.fenrus.org>
Date:	Sat, 14 Oct 2006 14:20:24 +0200
From:	Arjan van de Ven <arjan@...radead.org>
To:	Prarit Bhargava <prarit@...hat.com>
Cc:	linux-kernel@...r.kernel.org, akpm@...l.org
Subject: Re: [PATCH]: disassociate tty locking fixups


> @@ -1364,14 +1366,16 @@ static void do_tty_hangup(void *data)
>  				p->signal->tty = NULL;
>  			if (!p->signal->leader)
>  				continue;
> +			mutex_unlock(&tty_mutex);
>  			group_send_sig_info(SIGHUP, SEND_SIG_PRIV, p);
>  			group_send_sig_info(SIGCONT, SEND_SIG_PRIV, p);
> +			mutex_lock(&tty_mutex);
>  			if (tty->pgrp > 0)
>  				p->signal->tty_old_pgrp = tty->pgrp;
>  		} while_each_task_pid(tty->session, PIDTYPE_SID, p);
>  	}
>  	read_unlock(&tasklist_lock);
> -
> +	mutex_unlock(&tty_mutex);

Hi,

what is the lock ordering rules between tasklist_lock and tty_mutex?
In the code above you first take tty_mutex then tasklist_lock, and later
on you drop tty_mutex, with the result that you then have a
tasklist_lock -> tty_mutex order.

This can deadlock if someone gets in the middle with a
mutex_lock(&tty_mutex);
write_lock(&tasklist_lock);
....

in addition, are you sure you don't need to revalidate anything after
retaking the lock?

Greetings,
   Arjan van de Ven

-
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