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: <20141017161021.GC7227@redhat.com>
Date:	Fri, 17 Oct 2014 18:10:21 +0200
From:	Oleg Nesterov <oleg@...hat.com>
To:	Michal Hocko <mhocko@...e.cz>
Cc:	Cong Wang <xiyou.wangcong@...il.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	David Rientjes <rientjes@...gle.com>,
	"Rafael J. Wysocki" <rjw@...ysocki.net>, Tejun Heo <tj@...nel.org>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH -v2] freezer: check OOM kill while being frozen

On 10/17, Michal Hocko wrote:
>
> I think we should rather get back to __thaw_task here.

Yes, agreed.

> Andrew could you replace the previous version by this one, please?

Yes, that patch should be dropped...


And can't resist... please look at
http://marc.info/?l=linux-kernel&m=138427535430827 ;)

> --- a/kernel/freezer.c
> +++ b/kernel/freezer.c
> @@ -45,13 +45,28 @@ bool freezing_slow_path(struct task_struct *p)
>  	if (pm_nosig_freezing || cgroup_freezing(p))
>  		return true;
>
> -	if (pm_freezing && !(p->flags & PF_KTHREAD))
> +	if (!(p->flags & PF_KTHREAD))

Why? Doesn't this mean that try_to_freeze() can race with thaw_processes()
and then this task can be frozen for no reazon?

> +static bool should_thaw_current(bool check_kthr_stop)
> +{
> +	if (!freezing(current))
> +		return true;
> +
> +	if (check_kthr_stop && kthread_should_stop())
> +		return true;
> +
> +	/* It might not be safe to check TIF_MEMDIE for pm freeze. */
> +	if (cgroup_freezing(current) && test_thread_flag(TIF_MEMDIE))

I still think that the comment should tell more to explain why this
is not safe.

And if this is not safe, it is not clear how/why cgroup_freezing() can
save us, both pm_freezing and CGROUP_FREEZING can be true?

And I think that this TIF_MEMDIE should go into freezing_slow_path(),
so we do not even need should_thaw_current().

This also looks more safe to me. Suppose that a task does

	while (try_to_freeze())
		;

Yes, this is pointless but correct. And in fact I think this pattern
is possible. If this task is killed by OOM, it will spin forever.

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