Re: [PATCH] signals: work around random wakeups in sigsuspend()
From: Al Viro
Date: Thu Feb 25 2016 - 12:34:34 EST
On Thu, Feb 25, 2016 at 09:11:44AM +0100, Peter Zijlstra wrote:
> > Out of curiousity - where did that stray wakeup come from? PTRACE_KILL
> > used to trigger those, but that got fixed. How does one trigger that
> > kind of bugs on the current kernels?
> Its a regular TASK_INTERRUPTIBLE sleep, for those spurious wakeups are
> not a bug, they're pretty fundamentally allowed.
They are, which makes any code that doesn't expect them in such situations
> See: lkml.kernel.org/r/CA+55aFwHkOo+YGWKYROmce1-H_uG3KfEUmCkJUerTj=ojY2H6Q@xxxxxxxxxxxxxx
I know. The question is not whether the code must take them into account
(it must; it's a bug not to), it's what's a good way to trigger such bugs.
IOW, how to stress-test for such bugs?
PTRACE_KILL used to be a convenient way to arrange for a wakeup delivered
to victim engaged in something we want to stress; it doesn't do blind
wake_up_process() anymore, so that trick is gone. Is there anything
Suppose I have a dodgy waitqueue code (pardon the redundancy) in some
filesystem. I have some idea how to maneuver a process into such-and-such
part of that code; is there any convenient way to turn that into "... OK,
now let's add bombing it with stray wakeups"?