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]
Date:	Wed, 4 Apr 2007 19:28:28 +0400
From:	Oleg Nesterov <oleg@...sign.ru>
To:	Srivatsa Vaddagiri <vatsa@...ibm.com>
Cc:	Gautham R Shenoy <ego@...ibm.com>, akpm@...ux-foundation.org,
	paulmck@...ibm.com, torvalds@...ux-foundation.org,
	linux-kernel@...r.kernel.org, "Rafael J. Wysocki" <rjw@...k.pl>,
	mingo@...e.hu, dipankar@...ibm.com, dino@...ibm.com,
	masami.hiramatsu.pt@...achi.com
Subject: Re: [PATCH 7/8] Clean up workqueue.c with respect to the freezer based cpu-hotplug

On 04/03, Srivatsa Vaddagiri wrote:
>
> On Tue, Apr 03, 2007 at 07:03:36PM +0400, Oleg Nesterov wrote:
> 
> > is better to introduce a new helper for that, kthread_thaw_stop() or
> > something.
> 
> Will think of that.

I changed my mind :) The problem is general, I am starting to believe
it is better to change kthread_stop().

> > > kthread_stop(p)
> > > {
> > > 	int old_exempt_flags;
> > > 
> > > 	task_lock(p);
> > > 	old_exempt_flags = p->flags;
> > > 	p->flags |= PFE_ALL;	/* Exempt 'p' from being frozen? */
> > 
> > I agree, we should mark this thread as non-freezable, but we can't modify
> > p->flags, this is racy. "current" owns its ->flags and it is not atomic.
> > Note that thaw_process() checks frozen(p) when it clears PF_FROZEN.
> 
> I suspected that we cannot modify p->flags just like that. How abt
> moving freezer exemption bits to a separate field, which is protected by
> task_lock?

Probably yes... In that case it makes sense to move PF_FREEZER_SKIP/PF_FROZEN
to the new field as well.

Perhaps we can ignore this problem for now. Freezer is not 100% reliable
anyway. For example,

	worker_thread:

		for (;;) {
			try_to_freeze();

			prepare_to_wait();
			if (...)
				schedule();
			finish_wait();
		}

This is racy, we can miss freeze_process()->signal_wake_up() if it happens
between try_to_freeze() and prepare_to_wait(). We have to check TIF_FREEZE
before entering schedule() if we want to fix this race.

Should we? I don't know. This will uglify the code, and the probability
of this race is very low.

Oleg.

-
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