From: ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org (Eric W. Biederman)
To: Cyrill Gorcunov <gorcunov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Kees Cook <keescook-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>,
Andrey Vagin <avagin-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org>,
Linux Containers
<containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>,
LKML <linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Pavel Emelyanov <xemul-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org>
Subject: Re: [REVIEW][PATCH v2] mm: Add a user_ns owner to mm_struct and fix ptrace permission checks
Date: Thu, 27 Oct 2016 23:45:37 -0500 [thread overview]
Message-ID: <87pomlm68e.fsf@xmission.com> (raw)
In-Reply-To: <8760odnrf5.fsf-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org> (Eric W. Biederman's message of "Thu, 27 Oct 2016 21:22:38 -0500")
ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org (Eric W. Biederman) writes:
> Cyrill Gorcunov <gorcunov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:
>
>> On Fri, Oct 28, 2016 at 12:39:18AM +0300, Cyrill Gorcunov wrote:
>>> On Thu, Oct 27, 2016 at 10:54:34AM -0500, Eric W. Biederman wrote:
>>> >
>>> >
>>> > I can't imagine either of these changes making a practical difference
>>> > to anyone but I am calling them out in case someone can.
>>> >
>>> > include/linux/mm_types.h | 1 +
>>> > kernel/fork.c | 9 ++++++---
>>> > kernel/ptrace.c | 26 +++++++++++---------------
>>> > mm/init-mm.c | 2 ++
>>> > 4 files changed, 20 insertions(+), 18 deletions(-)
>>>
>>> Thanks a huge, Eric! And really sorry for delay in response,
>>> I managed to miss this quite important mail for me in mail
>>> storm. Gonna test it and will write you the results. Overall looks
>>> great, but better be sure and run the tests.
>>>
>>> Reviewed-by: Cyrill Gorcunov <gorcunov-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
>>
>> Eric, on which kernel the patch is on top of?
>> It doesn't apply on linux-next for some reason.
>>
>> | Date: Thu Oct 27 14:21:59 2016 +1100
>> |
>> | Add linux-next specific files for 20161027
>> |
>> | Signed-off-by: Stephen Rothwell <sfr-3FnU+UHB4dNDw9hX6IcOSA@public.gmane.org>
>>
>> I applied it on Linus' master and tests passed fine
>> (but they were passing fine even without the patch,
>> only linux-next failed).
>
> Odd. I don't think I have taken the old version out of
> linux-next yet. So you can probably revert the old version out of
> linux-next and apply this one. All of my development at this point is
> against v4.9-rc1.
>
> I suspect you will find my last version on top of against v4.9-rc1 will
> pass. Since my tree is only one deep and I don't think anyone except
> linux-next is based on it, I plan to drop and readd this patch.
> Especially since it is candidate for backporting.
Mind if I add your tested-by?
To see Linus's tree fail with my patch you can apply the patch below.
That is the essence of what I changed to fix things. Just ignoring
dumpable when an mm exists.
Eric
diff --git a/kernel/ptrace.c b/kernel/ptrace.c
index 44a25a1e6e83..b53983ee3f03 100644
--- a/kernel/ptrace.c
+++ b/kernel/ptrace.c
@@ -272,7 +272,7 @@ static int __ptrace_may_access(struct task_struct *task, unsigned int mode)
ok:
rcu_read_unlock();
mm = task->mm;
- if (mm &&
+ if (!mm ||
((get_dumpable(mm) != SUID_DUMP_USER) &&
!ptrace_has_cap(mm->user_ns, mode)))
return -EPERM;
next prev parent reply other threads:[~2016-10-28 4:45 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20161024105959.GQ1847@uranus.lan>
[not found] ` <20161024105959.GQ1847-ZmlpmtaulQd+urZeOPWqwQ@public.gmane.org>
2016-10-24 19:01 ` [ISSUE] mm: Add a user_ns owner to mm_struct and fix ptrace_may_access Eric W. Biederman
[not found] ` <8760oh8tbp.fsf-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
2016-10-24 20:29 ` Cyrill Gorcunov
[not found] ` <20161024202925.GS1847@uranus.lan>
[not found] ` <20161024202925.GS1847-ZmlpmtaulQd+urZeOPWqwQ@public.gmane.org>
2016-10-24 21:32 ` Kees Cook
[not found] ` <CAGXu5jK4p4bbQU1Bu-p9aM1GJ+CAR-FAHZcXXRH0De_M4VQ3wA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-10-24 23:11 ` Eric W. Biederman
[not found] ` <8760oh737b.fsf@xmission.com>
[not found] ` <8760oh737b.fsf-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
2016-10-25 9:02 ` Cyrill Gorcunov
[not found] ` <20161025090213.GX1847@uranus.lan>
[not found] ` <20161025090213.GX1847-ZmlpmtaulQd+urZeOPWqwQ@public.gmane.org>
2016-10-27 15:54 ` [REVIEW][PATCH v2] mm: Add a user_ns owner to mm_struct and fix ptrace permission checks Eric W. Biederman
[not found] ` <87d1ilrdmt.fsf_-_@xmission.com>
[not found] ` <87d1ilrdmt.fsf_-_-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
2016-10-27 21:27 ` Kees Cook
2016-10-27 21:39 ` Cyrill Gorcunov
[not found] ` <20161027213918.GA1922@uranus.lan>
[not found] ` <20161027213918.GA1922-ZmlpmtaulQd+urZeOPWqwQ@public.gmane.org>
2016-10-27 22:34 ` Cyrill Gorcunov
[not found] ` <20161027223430.GC1922@uranus.lan>
[not found] ` <20161027223430.GC1922-ZmlpmtaulQd+urZeOPWqwQ@public.gmane.org>
2016-10-28 2:22 ` Eric W. Biederman
[not found] ` <8760odnrf5.fsf-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
2016-10-28 4:45 ` Eric W. Biederman [this message]
[not found] ` <87pomlm68e.fsf-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
2016-10-28 7:06 ` Cyrill Gorcunov
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=87pomlm68e.fsf@xmission.com \
--to=ebiederm-as9lmozglivwk0htik3j/w@public.gmane.org \
--cc=avagin-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org \
--cc=containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
--cc=gorcunov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=keescook-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=xemul-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox