All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jann Horn <jann@thejh.net>
To: Corey Wright <undefined@pobox.com>
Cc: stable@vger.kernel.org
Subject: Re: [PATCH 1/1] proc: Fix ptrace-based permission checks for accessing task maps
Date: Sun, 28 Feb 2016 12:11:33 +0100	[thread overview]
Message-ID: <20160228111133.GA9926@pc.thejh.net> (raw)
In-Reply-To: <20160228024239.c82b6c2db17c670611ee6b16@pobox.com>

[-- Attachment #1: Type: text/plain, Size: 2324 bytes --]

On Sun, Feb 28, 2016 at 02:42:39AM -0600, Corey Wright wrote:
> 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.

The patch looks good to me, the FSCREDS mode is appropriate there.

(Note: There is probably going to be another patch that touches lots of
procfs stuff soon, and if it gets backported, the functions changed in
this patch should probably be changed for that backport again.)


> Signed-off-by: Corey Wright <undefined@pobox.com>
> Cc: Jann Horn <jann@thejh.net>
> ---
>  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 9f285fb..b86db12 100644
> --- a/fs/proc/task_mmu.c
> +++ b/fs/proc/task_mmu.c
> @@ -170,7 +170,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);
> @@ -1044,7 +1044,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 56123a6..123c198 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;
> -- 
> 1.7.9.5

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  parent reply	other threads:[~2016-02-28 11:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-28  8:39 [PATCH 0/1] proc: Fix ptrace-based permission checks for accessing task maps Corey Wright
2016-02-28  8:42 ` [PATCH 1/1] " Corey Wright
2016-02-28 10:00   ` [PATCH stable<3.18 " Jiri Slaby
2016-02-28 11:11   ` Jann Horn [this message]
2016-03-01  8:15   ` Patch "proc: Fix ptrace-based permission checks for accessing task maps" has been added to the 3.10-stable tree gregkh
2016-03-01  8:15   ` Patch "proc: Fix ptrace-based permission checks for accessing task maps" has been added to the 3.14-stable tree gregkh

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=20160228111133.GA9926@pc.thejh.net \
    --to=jann@thejh.net \
    --cc=stable@vger.kernel.org \
    --cc=undefined@pobox.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.