From: Henrik Saari Date: Thu, 11 Sep 2008 16:20:33 +0000 (+0300) Subject: Security: Kernel OOM-killer and allocation denial use different rules X-Git-Tag: v2.6.27-omap1~206 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=ad27614b78f8d17d1aa61ec7a8b4c1e862996c40;p=linux-2.6-omap-h63xx.git Security: Kernel OOM-killer and allocation denial use different rules Security: Kernel OOM-killer and allocation denial use different rules Original patch created by Leonid Moiseichuk Fixes the issue with the oom killer and lowmem module being inconsistent; processes that are important enough to be protected from the oom killer should not be denied memory either. Signed-off-by: Henrik Saari Signed-off-by: Viktor Rosendahl Signed-off-by: Tony Lindgren --- diff --git a/security/lowmem.c b/security/lowmem.c index a627d511f8e..113be754470 100644 --- a/security/lowmem.c +++ b/security/lowmem.c @@ -9,6 +9,7 @@ #include #include #include +#include #define MY_NAME "lowmem" @@ -207,6 +208,10 @@ static int low_vm_enough_memory(long pages) if (cap_sys_admin) return 0; + /* OOM unkillable process is allowed to consume memory */ + if (current->oomkilladj == OOM_DISABLE) + return 0; + /* uids from allowed_uids vector are also allowed no matter what */ for (i = 0; i < LOWMEM_MAX_UIDS && allowed_uids[i]; i++) if (current->uid == allowed_uids[i])