From: "Serge E. Hallyn" <serue@us.ibm.com>
To: lkml <linux-kernel@vger.kernel.org>, Andrew Morton <akpm@osdl.org>
Cc: Andrew Morgan <morgan@kernel.org>,
linux-security-module@vger.kernel.org,
Chris Wright <chrisw@sous-sol.org>
Subject: [PATCH 1/1] capabilities: oom_kill: don't set PF_SUPERPRIV for oom check
Date: Thu, 27 Dec 2007 15:03:32 -0600 [thread overview]
Message-ID: <20071227210332.GA24096@sergelap.austin.ibm.com> (raw)
>From ed2e7764917fd56d9743630bd7072f67ff30adc2 Mon Sep 17 00:00:00 2001
From: Serge Hallyn <serue@us.ibm.com>
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 <serue@us.ibm.com>
Acked-by: Andrew G. Morgan <morgan@kernel.org>
---
include/linux/capability.h | 2 ++
mm/oom_kill.c | 3 ++-
2 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/include/linux/capability.h b/include/linux/capability.h
index 7d50ff6..0acdd65 100644
--- a/include/linux/capability.h
+++ b/include/linux/capability.h
@@ -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__ */
diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index 9fd8d5d..cd515f8 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -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;
/*
--
1.5.1
reply other threads:[~2007-12-27 21:03 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20071227210332.GA24096@sergelap.austin.ibm.com \
--to=serue@us.ibm.com \
--cc=akpm@osdl.org \
--cc=chrisw@sous-sol.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=morgan@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®