Commit ad27614b authored by Henrik Saari's avatar Henrik Saari Committed by Tony Lindgren

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 <leonid.moiseichuk@nokia.com>

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: default avatarHenrik Saari <henrik.saari@nokia.com>
Signed-off-by: default avatarViktor Rosendahl <viktor.rosendahl@nokia.com>
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent 74fcfe9c
......@@ -9,6 +9,7 @@
#include <linux/pagemap.h>
#include <linux/hugetlb.h>
#include <linux/sysfs.h>
#include <linux/oom.h>
#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])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment