From: Andrey Vagin <avagin@virtuozzo.com>
To: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>,
LKML <linux-kernel@vger.kernel.org>,
Pavel Emelyanov <xemul@virtuozzo.com>
Subject: Re: [ISSUE] mm: Add a user_ns owner to mm_struct and fix ptrace_may_access
Date: Mon, 24 Oct 2016 12:00:35 -0700 [thread overview]
Message-ID: <20161024190034.GA29407@outlook.office365.com> (raw)
In-Reply-To: <20161024105959.GQ1847@uranus.lan>
On Mon, Oct 24, 2016 at 01:59:59PM +0300, Cyrill Gorcunov wrote:
> Hi Eric! A few days ago we've noticed that our zombie00 test case started
> failing: https://ci.openvz.org/job/CRIU/view/All/job/CRIU-linux-next/406/console
> ---
> ======================== Run zdtm/static/zombie00 in h =========================
> Start test
> ./zombie00 --pidfile=zombie00.pid --outfile=zombie00.out
> Run criu dump
> Run criu restore
> Send the 15 signal to 30
> Wait for zdtm/static/zombie00(30) to die for 0.100000
> ################ Test zdtm/static/zombie00 FAIL at result check ################
>
> I've narrowed problem down to commit
>
> | From ce99dd5fd5f600f9f4f0d37bb8847c1cb7c6e4fc Mon Sep 17 00:00:00 2001
> | From: "Eric W. Biederman" <ebiederm@xmission.com>
> | Date: Thu, 13 Oct 2016 21:23:16 -0500
> | Subject: [PATCH] mm: Add a user_ns owner to mm_struct and fix
> | ptrace_may_access
> |
> | During exec dumpable is cleared if the file that is being executed is
> | not readable by the user executing the file. A bug in
> | ptrace_may_access allows reading the file if the executable happens to
> | enter into a subordinate user namespace (aka clone(CLONE_NEWUSER),
> | unshare(CLONE_NEWUSER), or setns(fd, CLONE_NEWUSER).
>
> and the reason is that the zombie tasks do not have task::mm and in resut
> we're obtaining -EPERM when trying to read task->exit_code from /proc/pid/stat.
To be precise,
we are obtaining 0 instead of task->exit_ode, because permitted is
false:
static int do_task_stat(struct seq_file *m, struct pid_namespace *ns,
...
permitted = ptrace_may_access(task, PTRACE_MODE_READ_FSCREDS |
PTRACE_MODE_NOAUDIT);
...
if (permitted)
seq_put_decimal_ll(m, " ", task->exit_code);
else
seq_puts(m, " 0");
>
> Looking into commit I suspect when mm = NULL we've to move back the test
> ptrace_has_cap(__task_cred(task)->user_ns, mode)?
next prev parent reply other threads:[~2016-10-24 19:01 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-24 10:59 Cyrill Gorcunov
2016-10-24 19:00 ` Andrey Vagin [this message]
2016-10-24 19:01 ` Eric W. Biederman
2016-10-24 20:29 ` Cyrill Gorcunov
2016-10-24 21:32 ` Kees Cook
2016-10-24 23:11 ` Eric W. Biederman
2016-10-25 9:02 ` Cyrill Gorcunov
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
2016-10-27 21:27 ` Kees Cook
2016-10-27 21:39 ` Cyrill Gorcunov
2016-10-27 22:34 ` Cyrill Gorcunov
2016-10-28 2:22 ` Eric W. Biederman
2016-10-28 4:45 ` Eric W. Biederman
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=20161024190034.GA29407@outlook.office365.com \
--to=avagin@virtuozzo.com \
--cc=ebiederm@xmission.com \
--cc=gorcunov@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=xemul@virtuozzo.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome