capabilities: oom_kill: don't set PF_SUPERPRIV for oom check
Subsystems (3)
PATCH 1/1 capabilities: oom_kill: don't set PF_SUPERPRIV for oom check
Quoted 1 line
From
ed2e7764917fd56d9743630bd7072f67ff30adc2Mon Sep 17 00:00:00 2001
From: Serge Hallyn <[email protected]>
Date: Wed, 26 Dec 2007 15:04:50 -0800
Subject: [PATCH 1/1] capabilities: oom_kill: don't set PF_SUPERPRIV for oom check
With 64-bit capabilities came an inadvertent change such that the check for a privileged process, to make it less likely to be killed when out of memory, sets PF_SUPERPRIV, which it did not do before.
This patch restores the original behavior of not setting the PF_SUPERPRIV bit when checking for privileged processes.
Signed-off-by Serge Hallyn <[email protected]>
Acked-by Andrew G. Morgan <[email protected]>
--- include/linux/capability.h | 2 ++ mm/oom_kill.c | 3 ++- 2 files changed, 4 insertions(+), 1 deletions(-)
include/linux/capability.h +2 -0
@@ -490,6 +490,8 @@ extern const kernel_cap_t __cap_init_eff_set;int capable (int cap);int __capable (struct task_struct *t,int cap); +#define CAPABLE_PROBE_ONLY (a,b) (!security_capable(a,b)) +extern long cap_prctl_drop (unsigned long cap);#endif /* __KERNEL__ */
mm/oom_kill.c +2 -1
@@ -128,7 +128,8 @@ unsigned long badness(struct task_struct *p, unsigned long uptime,* Superuser processes are usually more important, so we make it * less likely that we kill those. */ -if (__capable (p,CAP_SYS_ADMIN ) ||__capable (p,CAP_SYS_RESOURCE )) +if (CAPABLE_PROBE_ONLY (p,CAP_SYS_ADMIN ) || +CAPABLE_PROBE_ONLY (p,CAP_SYS_RESOURCE )) points /=4 ;/*
Signature · 1 line
1.5.1