Re: [patch] futex: Cure exit race

From: Thomas Gleixner
Date: Wed Dec 19 2018 - 08:29:15 EST


On 2018-12-18 10:31, Thomas Gleixner wrote:
On Wed, 12 Dec 2018, Peter Zijlstra wrote:
On Mon, Dec 10, 2018 at 06:43:51PM +0100, Thomas Gleixner wrote:
@@ -806,6 +806,8 @@ void __noreturn do_exit(long code)
* task into the wait for ever nirwana as well.
*/
tsk->flags |= PF_EXITPIDONE;
+ smp_mb();
+ wake_up_bit(&tsk->flags, 3 /* PF_EXITPIDONE */);

Using ilog2(PF_EXITPIDONE) spares that horrible inline comment and more
importantly selects the right bit. 0x04 is bit 2 ....

Plus wake_up_bit() and wait_on_bit() want an unsigned long, but tsk->flags is
unsigned int....

Moar staring....