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: <YrlYDppYKw6HRP1j@hirez.programming.kicks-ass.net>
Date:   Mon, 27 Jun 2022 09:11:10 +0200
From:   Peter Zijlstra <peterz@...radead.org>
To:     Wedson Almeida Filho <wedsonaf@...gle.com>
Cc:     "Eric W. Biederman" <ebiederm@...ssion.com>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        Christian Brauner <brauner@...nel.org>,
        Tejun Heo <tj@...nel.org>, Petr Mladek <pmladek@...e.com>,
        Lai Jiangshan <jiangshanlai@...il.com>,
        Michal Hocko <mhocko@...e.com>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Oleg Nesterov <oleg@...hat.com>
Subject: Re: re. Spurious wakeup on a newly created kthread

On Mon, Jun 27, 2022 at 12:01:04AM +0000, Wedson Almeida Filho wrote:
> On Sat, Jun 24, 2022 at 07:19:27PM -0500, Eric W. Biederman wrote:
> > 
> > Further it is necessary for Peter Zijlstra's rewrite of the kernel
> > freezer.   As anything that isn't a special stop state (which
> > TASK_UNINTERRUPTIBLE is not) will receive a spurious wake up on when
> > thawed out.
> 
> Do you know if the current (i.e., prior to the rewrite) kernel freezer
> also sends spurious wakeups when thawing tasks?

Current freezer can thaw at random points in time, even before SMP
bringup if you're unlucky. And yes, I think it can induce 'spurious'
wakeups as well.

But really; like Linus already said upsteam, every wait loop *MUST*
already be able to deal with spurious wakeups. This is why pretty much
every wait primitive we have looks like:

	for (;;) {
		set_current_state(state);
		if (cond)
			break;
		schedule();
	}
	__set_current_state(RUNNING);

Which is immune to random wake-ups since it need @cond to make progress.
*NEVER* rely on just the wakeup itself for progress, that's buggy as
heck in lots of ways.

There are a few exceptions, but they all require special wait states and
much carefulness.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ