Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1350104

[PATCH 3.12 001/116] proc: Fix ptrace-based permission checks for accessing task maps

From Jiri Slaby <jslaby@suse.cz>
Newsgroups linux.kernel
Subject [PATCH 3.12 001/116] proc: Fix ptrace-based permission checks for accessing task maps
Date 2016-03-04 11:00 +0100
Message-ID <r8TUd-4rg-3@gated-at.bofh.it> (permalink)
References <r8TUf-4rg-31@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Corey Wright <undefined@pobox.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

Modify mm_access() calls in fs/proc/task_mmu.c and fs/proc/task_nommu.c to
have the mode include PTRACE_MODE_FSCREDS so accessing /proc/pid/maps and
/proc/pid/pagemap is not denied to all users.

In backporting upstream commit caaee623 to pre-3.18 kernel versions it was
overlooked that mm_access() is used in fs/proc/task_*mmu.c as those calls
were removed in 3.18 (by upstream commit 29a40ace) and did not exist at the
time of the original commit.

Fixes: caaee6234d ("ptrace: use fsuid, fsgid, effective creds for fs access checks")
Signed-off-by: Corey Wright <undefined@pobox.com>
Acked-by: Jann Horn <jann@thejh.net>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 fs/proc/task_mmu.c   | 4 ++--
 fs/proc/task_nommu.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index d20f37d1c6e7..4fe8b1082cf3 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -172,7 +172,7 @@ static void *m_start(struct seq_file *m, loff_t *pos)
 	if (!priv->task)
 		return ERR_PTR(-ESRCH);
 
-	mm = mm_access(priv->task, PTRACE_MODE_READ);
+	mm = mm_access(priv->task, PTRACE_MODE_READ_FSCREDS);
 	if (!mm || IS_ERR(mm))
 		return mm;
 	down_read(&mm->mmap_sem);
@@ -1186,7 +1186,7 @@ static ssize_t pagemap_read(struct file *file, char __user *buf,
 	if (!pm.buffer)
 		goto out_task;
 
-	mm = mm_access(task, PTRACE_MODE_READ);
+	mm = mm_access(task, PTRACE_MODE_READ_FSCREDS);
 	ret = PTR_ERR(mm);
 	if (!mm || IS_ERR(mm))
 		goto out_free;
diff --git a/fs/proc/task_nommu.c b/fs/proc/task_nommu.c
index 56123a6f462e..123c19890b14 100644
--- a/fs/proc/task_nommu.c
+++ b/fs/proc/task_nommu.c
@@ -223,7 +223,7 @@ static void *m_start(struct seq_file *m, loff_t *pos)
 	if (!priv->task)
 		return ERR_PTR(-ESRCH);
 
-	mm = mm_access(priv->task, PTRACE_MODE_READ);
+	mm = mm_access(priv->task, PTRACE_MODE_READ_FSCREDS);
 	if (!mm || IS_ERR(mm)) {
 		put_task_struct(priv->task);
 		priv->task = NULL;
-- 
2.7.2

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 3.12 000/116] 3.12.56-stable review Jiri Slaby <jslaby@suse.cz> - 2016-03-04 10:10 +0100
  [PATCH 3.12 001/116] proc: Fix ptrace-based permission checks for accessing task maps Jiri Slaby <jslaby@suse.cz> - 2016-03-04 11:00 +0100
    [PATCH 3.12 016/116] bonding: Fix ARP monitor validation Jiri Slaby <jslaby@suse.cz> - 2016-03-04 11:00 +0100
    [PATCH 3.12 007/116] pptp: fix illegal memory access caused by multiple bind()s Jiri Slaby <jslaby@suse.cz> - 2016-03-04 11:00 +0100
    [PATCH 3.12 012/116] net:Add sysctl_max_skb_frags Jiri Slaby <jslaby@suse.cz> - 2016-03-04 11:00 +0100
    [PATCH 3.12 006/116] af_unix: fix struct pid memory leak Jiri Slaby <jslaby@suse.cz> - 2016-03-04 11:00 +0100
    [PATCH 3.12 008/116] sctp: allow setting SCTP_SACK_IMMEDIATELY by the application Jiri Slaby <jslaby@suse.cz> - 2016-03-04 11:00 +0100
    [PATCH 3.12 009/116] ipv6/udp: use sticky pktinfo egress ifindex on connect() Jiri Slaby <jslaby@suse.cz> - 2016-03-04 11:00 +0100
    [PATCH 3.12 011/116] ipv6: fix a lockdep splat Jiri Slaby <jslaby@suse.cz> - 2016-03-04 11:00 +0100
    [PATCH 3.12 015/116] bonding: fix bond_arp_rcv() race of curr_active_slave Jiri Slaby <jslaby@suse.cz> - 2016-03-04 11:00 +0100
  Re: [PATCH 3.12 000/116] 3.12.56-stable review Guenter Roeck <linux@roeck-us.net> - 2016-03-04 15:10 +0100
    Re: [PATCH 3.12 000/116] 3.12.56-stable review Jiri Slaby <jslaby@suse.cz> - 2016-03-08 16:50 +0100
  Re: [PATCH 3.12 000/116] 3.12.56-stable review Shuah Khan <shuahkh@osg.samsung.com> - 2016-03-04 15:50 +0100

csiph-web