public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* A couple of OOM killer races
@ 2005-09-01 20:44 Richard Hayden
  2005-09-02  1:29 ` Zhou Yingchao
  2005-09-08  2:09 ` Coywolf Qi Hunt
  0 siblings, 2 replies; 3+ messages in thread
From: Richard Hayden @ 2005-09-01 20:44 UTC (permalink / raw)
  To: linux-kernel; +Cc: coywolf

Hi all,

It appears there is no protection in badness() (called by 
out_of_memory() for each process) when it reads p->mm->total_vm. Another 
processor (or a kernel preemption) could presumably run do_exit and then 
exit_mm, freeing the process in question's reference to its mm just 
after the (!p->mm) check but before it reads p->mm->total_vm, making the 
latter reference a null pointer reference.

Also there appears to be no protection when we set p->time_slice in 
__oom_kill_task(). Am I right in thinking that this field should be 
protected by the appropriate runqueue lock, at least this is what 
scheduler_tick() seems to use?

Have I missed anything?

Best regards,

Richard Hayden.

		
___________________________________________________________ 
How much free photo storage do you get? Store your holiday 
snaps for FREE with Yahoo! Photos http://uk.photos.yahoo.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: A couple of OOM killer races
  2005-09-01 20:44 A couple of OOM killer races Richard Hayden
@ 2005-09-02  1:29 ` Zhou Yingchao
  2005-09-08  2:09 ` Coywolf Qi Hunt
  1 sibling, 0 replies; 3+ messages in thread
From: Zhou Yingchao @ 2005-09-02  1:29 UTC (permalink / raw)
  To: Richard Hayden; +Cc: linux-kernel

On 9/2/05, Richard Hayden <rahaydenuk@yahoo.co.uk> wrote:
> Hi all,
> 
> It appears there is no protection in badness() (called by
> out_of_memory() for each process) when it reads p->mm->total_vm. Another
> processor (or a kernel preemption) could presumably run do_exit and then
> exit_mm, freeing the process in question's reference to its mm just
> after the (!p->mm) check but before it reads p->mm->total_vm, making the
> latter reference a null pointer reference.

 In badness, the tasklist_lock has been hold. And when an exit signal
delived to it because other thread call do_group_exit, it need to hold
the tasklist_lock first, so we are protected.
  
-- 
Yingchao Zhou

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: A couple of OOM killer races
  2005-09-01 20:44 A couple of OOM killer races Richard Hayden
  2005-09-02  1:29 ` Zhou Yingchao
@ 2005-09-08  2:09 ` Coywolf Qi Hunt
  1 sibling, 0 replies; 3+ messages in thread
From: Coywolf Qi Hunt @ 2005-09-08  2:09 UTC (permalink / raw)
  To: Richard Hayden; +Cc: linux-kernel

On 9/2/05, Richard Hayden <rahaydenuk@yahoo.co.uk> wrote:
> Hi all,
> 
> It appears there is no protection in badness() (called by
> out_of_memory() for each process) when it reads p->mm->total_vm. Another
> processor (or a kernel preemption) could presumably run do_exit and then
> exit_mm, freeing the process in question's reference to its mm just
> after the (!p->mm) check but before it reads p->mm->total_vm, making the
> latter reference a null pointer reference.

We have read_lock(&tasklist_lock); .

> 
> Also there appears to be no protection when we set p->time_slice in
> __oom_kill_task(). Am I right in thinking that this field should be
> protected by the appropriate runqueue lock, at least this is what
> scheduler_tick() seems to use?

ditto

-- 
Coywolf Qi Hunt
http://sosdg.org/~coywolf/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-09-08  2:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-01 20:44 A couple of OOM killer races Richard Hayden
2005-09-02  1:29 ` Zhou Yingchao
2005-09-08  2:09 ` Coywolf Qi Hunt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox