[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.00.1009011519070.29305@chino.kir.corp.google.com>
Date: Wed, 1 Sep 2010 15:25:14 -0700 (PDT)
From: David Rientjes <rientjes@...gle.com>
To: Tetsuo Handa <penguin-kernel@...ove.sakura.ne.jp>
cc: linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
kosaki.motohiro@...fujitsu.com, spender@...ecurity.net,
eric.dumazet@...il.com
Subject: Re: How can OOM killer detect process consuming much kernel
memory?
On Thu, 2 Sep 2010, Tetsuo Handa wrote:
> Is it possible to make OOM killer to kill processes consuming kernel memory
> rather than userspace memory?
>
> I'm happy if OOM killer can select victim process based on both kernel memory
> usage and userspace memory usage. For example, opening a file requires kernel
> memory allocation (e.g. /sys/kernel/security/tomoyo/self_domain allocates 8KB
> of kernel memory). Therefore, I refuse allowing everybody to open that file
> even if the content is public (because an attacker would open
> /sys/kernel/security/tomoyo/self_domain as many as possible using
> fork() and open() in order to exhaust kernel memory).
The oom killer has been rewritten for 2.6.36, so it'd probably help to
frame it in the context of its new behavior, which you can try out in
2.6.36-rc3.
The case you're describing would be difficult to kill with the oom killer
because each fork() and exec() would be considered as seperate users of
memory, so an aggregate of kernel memory amongst these threads wouldn't be
considered.
The oom killer isn't really concerned whether the memory was allocated in
userspace or kernelspace, the only thing that matters is that it's used
and is unreclaimable (and non-migratable).
The memory controller accounts for user memory, so it's probably not a
sufficient alternative either in this case. Is it not possible for the
kernel to intelligently limit the amount of memory that it can allocate
through an interface at any given time?
--
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