[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <lsq.1514480744.609944147@decadent.org.uk>
Date: Thu, 28 Dec 2017 17:05:44 +0000
From: Ben Hutchings <ben@...adent.org.uk>
To: linux-kernel@...r.kernel.org, stable@...r.kernel.org
CC: akpm@...ux-foundation.org,
"Casey Schaufler" <casey@...aufler-ca.com>,
"Kees Cook" <keescook@...omium.org>,
"Eric W. Biederman" <ebiederm@...ssion.com>,
"Linus Torvalds" <torvalds@...ux-foundation.org>,
"Willy Tarreau" <w@....eu>, "Oleg Nesterov" <oleg@...hat.com>,
"James Morris" <james.l.morris@...cle.com>,
"Jann Horn" <jann@...jh.net>, "Ingo Molnar" <mingo@...hat.com>,
"Andy Shevchenko" <andriy.shevchenko@...ux.intel.com>,
"Al Viro" <viro@...iv.linux.org.uk>,
"Andy Lutomirski" <luto@...nel.org>,
"Serge E. Hallyn" <serge.hallyn@...ntu.com>
Subject: [PATCH 3.16 194/204] security: let security modules use
PTRACE_MODE_* with bitmasks
3.16.52-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jann Horn <jann@...jh.net>
commit 3dfb7d8cdbc7ea0c2970450e60818bb3eefbad69 upstream.
It looks like smack and yama weren't aware that the ptrace mode
can have flags ORed into it - PTRACE_MODE_NOAUDIT until now, but
only for /proc/$pid/stat, and with the PTRACE_MODE_*CREDS patch,
all modes have flags ORed into them.
Signed-off-by: Jann Horn <jann@...jh.net>
Acked-by: Kees Cook <keescook@...omium.org>
Acked-by: Casey Schaufler <casey@...aufler-ca.com>
Cc: Oleg Nesterov <oleg@...hat.com>
Cc: Ingo Molnar <mingo@...hat.com>
Cc: James Morris <james.l.morris@...cle.com>
Cc: "Serge E. Hallyn" <serge.hallyn@...ntu.com>
Cc: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: Andy Lutomirski <luto@...nel.org>
Cc: Al Viro <viro@...iv.linux.org.uk>
Cc: "Eric W. Biederman" <ebiederm@...ssion.com>
Cc: Willy Tarreau <w@....eu>
Signed-off-by: Andrew Morton <akpm@...ux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@...ux-foundation.org>
Signed-off-by: Ben Hutchings <ben@...adent.org.uk>
---
security/smack/smack_lsm.c | 8 +++-----
security/yama/yama_lsm.c | 4 ++--
2 files changed, 5 insertions(+), 7 deletions(-)
--- a/security/smack/smack_lsm.c
+++ b/security/smack/smack_lsm.c
@@ -163,12 +163,10 @@ static int smk_copy_rules(struct list_he
*/
static inline unsigned int smk_ptrace_mode(unsigned int mode)
{
- switch (mode) {
- case PTRACE_MODE_READ:
- return MAY_READ;
- case PTRACE_MODE_ATTACH:
+ if (mode & PTRACE_MODE_ATTACH)
return MAY_READWRITE;
- }
+ if (mode & PTRACE_MODE_READ)
+ return MAY_READ;
return 0;
}
--- a/security/yama/yama_lsm.c
+++ b/security/yama/yama_lsm.c
@@ -292,7 +292,7 @@ int yama_ptrace_access_check(struct task
return rc;
/* require ptrace target be a child of ptracer on attach */
- if (mode == PTRACE_MODE_ATTACH) {
+ if (mode & PTRACE_MODE_ATTACH) {
switch (ptrace_scope) {
case YAMA_SCOPE_DISABLED:
/* No additional restrictions. */
@@ -318,7 +318,7 @@ int yama_ptrace_access_check(struct task
}
}
- if (rc) {
+ if (rc && (mode & PTRACE_MODE_NOAUDIT) == 0) {
printk_ratelimited(KERN_NOTICE
"ptrace of pid %d was attempted by: %s (pid %d)\n",
child->pid, current->comm, current->pid);
Powered by blists - more mailing lists