Re: [PATCH 1/1] mm/madvise: replace ptrace attach requirement for process_madvise

From
David Rientjes <rientjes@google.com>
Date
2021-01-09 01:03:14
Also in
linux-mm, lkml, selinux
Reply to
Suren Baghdasaryan, 2021-01-08
On Fri, 8 Jan 2021, Suren Baghdasaryan wrote:
quoted
quoted
@@ -1197,12 +1197,22 @@ SYSCALL_DEFINE5(process_madvise, int, pidfd, const struct iovec __user *, vec,
              goto release_task;
      }

-     mm = mm_access(task, PTRACE_MODE_ATTACH_FSCREDS);
+     /* Require PTRACE_MODE_READ to avoid leaking ASLR metadata. */
+     mm = mm_access(task, PTRACE_MODE_READ_FSCREDS);
      if (IS_ERR_OR_NULL(mm)) {
              ret = IS_ERR(mm) ? PTR_ERR(mm) : -ESRCH;
              goto release_task;
      }

+     /*
+      * Require CAP_SYS_NICE for influencing process performance. Note that
+      * only non-destructive hints are currently supported.
+      */
+     if (!capable(CAP_SYS_NICE)) {
+             ret = -EPERM;
+             goto release_task;
mmput?
Ouch! Thanks for pointing it out! Will include in the next respin.
With the fix, feel free to add:

	Acked-by: David Rientjes [off-list ref]

Thanks Suren!
Thread (5 messages) 5 messages, 3 authors, last reply 2021-01-09
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help