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: <20110819155222.GA17879@redhat.com>
Date:	Fri, 19 Aug 2011 17:52:22 +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
Subject: Re: [PATCH 01/16] freezer: fix current->state restoration race in
	refrigerator()

I'll try to read this series later.

Probably this doesn't matter since I didn't read the next patches, but

On 08/19, Tejun Heo wrote:
>
> refrigerator() saves current->state before entering frozen state and
> restores it before returning using __set_current_state(); however,
> this is racy,

Oh, yes. I even tried to ask for the explanation.

> 	set_current_state(TASK_INTERRUPTIBLE);
> 	try_to_sleep();
> 	if (kthread_should_stop())
> 		break;
> 	schedule();

Indeed, we can miss kthread->should_stop, and the patch fixes this
case.

But please look at, say, kauditd_thread(), it does

		DECLARE_WAITQUEUE(wait, current);
		set_current_state(TASK_INTERRUPTIBLE);
		add_wait_queue(&kauditd_wait, &wait);

		if (!skb_queue_len(&audit_skb_queue)) {
			try_to_freeze();
			schedule();
		}

Now suppose that wake_up_interruptible(&kauditd_wait) happens, and
after that refrigerator() restores TASK_INTERRUPTIBLE.

Any reason refrigerator() should try to restore? Shouldn't we simply
change the rules? Yes, probably we will have to fix some users.

But it seems to me it is simply not possible to make this ->state
restoration correct.

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