Re: [ISSUE] mm: Add a user_ns owner to mm_struct and fix ptrace_may_access
From: Kees Cook
Date: Mon Oct 24 2016 - 17:32:15 EST
On Mon, Oct 24, 2016 at 1:29 PM, Cyrill Gorcunov <gorcunov@xxxxxxxxx> wrote:
> On Mon, Oct 24, 2016 at 02:01:30PM -0500, Eric W. Biederman wrote:
>> So I am probably going to tweak the !mm case so that instead of failing
>> we perform the old capable check in that case. That seems the mot
>> certain way to avoid regressions. With that said, why is exit_code
>> behind a ptrace_may_access permission check?
>
> Yes, this would be great! And as to @exit_code I think better ask
> Kees, CC'ed.
My concern was that this was an exposure in the sense that it is
internal program state that isn't visible through other means (without
being the parent, for example). Under the ptrace check, it has an
equivalency that seemed correct at the time.
As already covered, I'd agree: it looks like ce99dd5fd5f6 accidentally
added a dependency on task->mm where it didn't before. That section of
logic was entirely around dumpability, not an mm existing. It should
be "EPERM if mm and dumpable != SUID_DUMP_USER".
That said, I'd also agree that ptrace against no mm is crazy (though I
suppose that should return EINVAL or ESRCH or something), so perhaps a
better access control on @exit_code is needed here.
-Kees
--
Kees Cook
Nexus Security