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: <alpine.LFD.1.10.0805241039220.3295@apollo.tec.linutronix.de>
Date:	Sat, 24 May 2008 10:55:15 +0200 (CEST)
From:	Thomas Gleixner <tglx@...utronix.de>
To:	Daniel Walker <dwalker@...sta.com>
cc:	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/3] futex: fix miss ordered wakeups

On Thu, 22 May 2008, Daniel Walker wrote:

> When the plist was added to futexes it added overhead to sort based
> on priority for the futex waiters. If there is a miss order the value of
> this, from my perspective, is lost. Since we don't re-order tasks
> when their priority is changed after they sleep then we get a miss ordered
> scenerio, and tasks aren't woken in priority order.

This is a solution looking for a problem. 

Normal futexes have no ordering guarantees at all. There is no
mechanism to prevent lock stealing from lower priority tasks. So why
should we care about the once a year case, where a sleepers priority
is modified ?

If you need ordering guarantees then use PI futexes.

> This patch corrects this issue, so the tasks are always woken in priority
> order.

The patch corrects a non issue and introduces lock order issues:

> +void futex_adjust_waiters(struct task_struct *p)
> +{
> +	spin_lock(&p->pi_lock);
> +		spin_lock(&hb->lock);
> ...
> +		spin_unlock(&hb->lock);
> +	}
> +	spin_unlock(&p->pi_lock);
> +}

vs.

> @@ -1155,6 +1191,8 @@ static int futex_wait(u32 __user *uaddr,
{
....
        hb = queue_lock(&q);

> +	spin_lock(&current->pi_lock);
> +	current->blocked_on = &blocked_on;
> +	spin_unlock(&current->pi_lock);

There are more issues vs. pi futexes as well. The simple case of
futex_wait() vs. futex_adjust_waiters will just upset lockdep, but
there are real dealocks vs. unqueue_me_pi waiting.

Thanks,
	tglx

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