fix mm_access bug in pagemap_read
Quoted 7 lines · Joe Korty
Hi Jann,
The following linux-4.1.y git commit, y > 17,Commit
caaee6234d05a58c5b4d05e7bf766131b810a657
Author: Jann Horn <[email protected]>
Date: Wed Jan 20 15:00:04 2016 -0800
Quoted 7 lines
ptrace: use fsuid, fsgid, effective creds for fs access checks
broke linux-4.1.y with the following oops, repeated forever.
[ 81.122531] ------------[ cut here ]------------ [ 81.127161] WARNING: CPU: 6 PID: 5553 at kernel/ptrace.c:248 __ptrace_may_access+0x18a/0x1a0() [ 81.135780] denying ptrace access check without PTRACE_MODE_*CREDS
(Nit: That's just a warning, not an oops - it blocks access, but doesn't kill the calling process. But still not good, of course.)
Quoted 4 lines
The problem is that the above git commit missed one
mm_accesscall that needed converting. In this patch, we convertPTRACE_MODE_READtoPTRACE_MODE_READ_FSCREDSas that seems more correct forpagemap_readthanPTRACE_MODE_READ_REALCREDS.
Yup, PTRACE_MODE_READ_FSCREDS is appropriate here.
Quoted 17 lines
There may be stable releases other than linux-4.1.y that need this fix.
Signed-off-by Joe Korty <[email protected]>Index:
b/fs/proc/task_mmu.c
===================================================================fs/proc/task_mmu.c +1
-1@@ -1257,7 +1257,7 @@ static ssize_t pagemap_read(struct fileif (!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;
Jann Horn
Acked-byQuoted 49 lines · Joe Korty
Quoted 40 lines · Jann Horn
Quoted 7 lines · Joe Korty
Hi Jann,
The following linux-4.1.y git commit, y > 17,Commit
caaee6234d05a58c5b4d05e7bf766131b810a657
Author: Jann Horn <[email protected]>
Date: Wed Jan 20 15:00:04 2016 -0800Quoted 7 lines
ptrace: use fsuid, fsgid, effective creds for fs access checks
broke linux-4.1.y with the following oops, repeated forever.
[ 81.122531] ------------[ cut here ]------------ [ 81.127161] WARNING: CPU: 6 PID: 5553 at kernel/ptrace.c:248 __ptrace_may_access+0x18a/0x1a0() [ 81.135780] denying ptrace access check without PTRACE_MODE_*CREDS(Nit: That's just a warning, not an oops - it blocks access, but doesn't kill the calling process. But still not good, of course.)
Quoted 4 lines
The problem is that the above git commit missed one
mm_accesscall that needed converting. In this patch, we convertPTRACE_MODE_READtoPTRACE_MODE_READ_FSCREDSas that seems more correct forpagemap_readthanPTRACE_MODE_READ_REALCREDS.Yup,
PTRACE_MODE_READ_FSCREDSis appropriate here.Quoted 12 lines
There may be stable releases other than linux-4.1.y that need this fix.
Signed-off-by Joe Korty <[email protected]>Index:
b/fs/proc/task_mmu.c
===================================================================fs/proc/task_mmu.c +0
-0@@ -1257,7 +1257,7 @@ static ssize_t pagemap_read(struct fileif (!pm.buffer) goto out_task;Quoted 6 lines
fs/proc/task_mmu.c static ssize_t pagemap_read(struct file · line 1263
Quoted 5 lines
fs/proc/task_mmu.c +1
-1- 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;
Quoted 2 lines
Hi Jann,
Greg may need an 'Acked-by' from you before he can apply this fix.
Ah, okay. Sure, you can add:
Quoted 2 lines
Greg, I just looked at the longterm and the 4.7 releases and it appears that only 4.1 and 3.18 need this fix.