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:	Sun, 21 Aug 2011 21:14:21 +0200
From:	Oleg Nesterov <oleg@...hat.com>
To:	Tejun Heo <tj@...nel.org>
Cc:	rjw@...k.pl, menage@...gle.com, linux-kernel@...r.kernel.org,
	arnd@...db.de, Jens Axboe <axboe@...nel.dk>,
	Henrique de Moraes Holschuh <ibm-acpi@....eng.br>
Subject: Re: [PATCH 04/16] freezer: implement and use
	kthread_freezable_should_stop()

On 08/19, Tejun Heo wrote:
>
> +bool kthread_freezable_should_stop(bool *was_frozen)
> +{
> +	bool frozen = false;
> +
> +	might_sleep();
> +
> +	if (unlikely(freezing(current)))
> +		frozen = __refrigerator(true);
> +
> +	if (was_frozen)
> +		*was_frozen = frozen;
> +
> +	return kthread_should_stop();
> +}

Imho, nice interface...

So, the caller can not miss the kthread_stop() request and freeze.
And the change in __refrigerator() means that kthread_should_stop()
acts as thaw_process() (in some sense).

But. can't __refrigerator() race with thaw_process() in this case?

> +bool __refrigerator(bool check_kthr_stop)
>  {
>  	/* Hmm, should we be allowed to suspend when there are realtime
>  	   processes around? */
> @@ -50,7 +51,8 @@ bool __refrigerator(void)
>
>  	for (;;) {
>  		set_current_state(TASK_UNINTERRUPTIBLE);
> -		if (!frozen(current))
> +		if (!frozen(current) ||
> +		    (check_kthr_stop && kthread_should_stop()))
>  			break;

OK, but then we do

	current->flags &= ~PF_FREEZING;

since PF_FROZEN wasn't cleared this can race with

	p->flags &= ~PF_FROZEN;

No?

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