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: <20110927075245.GA25807@tiehlicka.suse.cz>
Date:	Tue, 27 Sep 2011 09:52:45 +0200
From:	Michal Hocko <mhocko@...e.cz>
To:	David Rientjes <rientjes@...gle.com>
Cc:	"Rafael J. Wysocki" <rjw@...k.pl>, Oleg Nesterov <oleg@...hat.com>,
	Konstantin Khlebnikov <khlebnikov@...nvz.org>,
	linux-mm@...ck.org, Andrew Morton <akpm@...ux-foundation.org>,
	linux-kernel@...r.kernel.org,
	KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>,
	Tejun Heo <tj@...nel.org>,
	Rusty Russell <rusty@...tcorp.com.au>
Subject: Re: [PATCH 1/2] oom: do not live lock on frozen tasks

On Mon 26-09-11 18:03:26, David Rientjes wrote:
> On Mon, 26 Sep 2011, Rafael J. Wysocki wrote:
> 
> > > Konstantin Khlebnikov has reported (https://lkml.org/lkml/2011/8/23/45)
> > > that OOM can end up in a live lock if select_bad_process picks up a frozen
> > > task.
> > > Unfortunately we cannot mark such processes as unkillable to ignore them
> > > because we could panic the system even though there is a chance that
> > > somebody could thaw the process so we can make a forward process (e.g. a
> > > process from another cpuset or with a different nodemask).
> > > 
> > > Let's thaw an OOM selected frozen process right after we've sent fatal
> > > signal from oom_kill_task.
> > > Thawing is safe if the frozen task doesn't access any suspended device
> > > (e.g. by ioctl) on the way out to the userspace where we handle the
> > > signal and die. Note, we are not interested in the kernel threads because
> > > they are not oom killable.
> > > 
> > > Accessing suspended devices by a userspace processes shouldn't be an
> > > issue because devices are suspended only after userspace is already
> > > frozen and oom is disabled at that time.
> > > 
> > > run_guest (drivers/lguest/core.c) calls try_to_freeze with an user
> > > context but it seems it is able to cope with signals because it
> > > explicitly checks for pending signals so we should be safe.
> > > 
> > > Other than that userspace accesses the fridge only from the
> > > signal handling routines so we are able to handle SIGKILL without any
> > > negative side effects.
> > > 
> > > Signed-off-by: Michal Hocko <mhocko@...e.cz>
> > > Reported-by: Konstantin Khlebnikov <khlebnikov@...nvz.org>
> > 
> > Acked-by: Rafael J. Wysocki <rjw@...k.pl>
> > 
> 
> Acked-by: David Rientjes <rientjes@...gle.com>

Thanks!

> 
> Although this still seems to be problematic if the chosen thread gets 
> frozen before the SIGKILL can be handled.  We don't have any checks for 
> fatal_signal_pending() when freezing threads and waiting for them to exit?

I guess you mean a situation when select_bad_process picks up a process
which is not marked as frozen yet but we send SIGKILL right before
schedule is called in refrigerator. 
In that case either schedule should catch it by signal_pending_state
check or we will pick it up next OOM round when we pick up the same
process (if nothing else is eligible). Or am I missing something?
 
> Michal, could you send Andrew your revised patch with all the acked-bys?

Yes I will. I would just like to hear back from Konstantin who
originally reported the issue. Maybe he has a test case.

> 
> Thanks!
> --
> 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/

-- 
Michal Hocko
SUSE Labs
SUSE LINUX s.r.o.
Lihovarska 1060/12
190 00 Praha 9    
Czech Republic
--
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