From: ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org (Eric W. Biederman)
To: Gao feng <gaofeng-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
Cc: Richard Weinberger <richard-/L3Ra7n9ekc@public.gmane.org>,
containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
Serge Hallyn
<serge.hallyn-GeWIH/nMZzLQT0dZR+AlfA@public.gmane.org>
Subject: Re: Interaction user namespace, /proc/1 ownership & cap_set
Date: Tue, 02 Jul 2013 01:44:49 -0700 [thread overview]
Message-ID: <87wqp9uz9a.fsf@xmission.com> (raw)
In-Reply-To: <51D261D3.3030002-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org> (Gao feng's message of "Tue, 02 Jul 2013 13:14:59 +0800")
Gao feng <gaofeng-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org> writes:
> On 07/02/2013 12:16 AM, Daniel P. Berrange wrote:
>> I'm struggling debugging a strange problem with interaction between user
>> namespaces, cap_set and ownership of files in /proc/1/
>>
>
> This problem is occured after we call setuid/gid.
>
> for example, a task whose pid is 1234 calls
> setregid(10,10);
> setreuid(10,10);
>
>
> The uid/gid of the /proc/1234 is 10:0
> ll /proc/1234 -d
> dr-xr-xr-x 8 uucp wheel 0 Jul 2 10:57 /proc/1234
>
> the uid/gid of the files under /proc/1234 are two kinds...
> ll /proc/1234
> dr-xr-xr-x 2 uucp wheel 0 Jul 2 10:58 attr
> -rw-r--r-- 1 root root 0 Jul 2 10:58 autogroup
> ...
> dr-xr-xr-x 5 uucp wheel 0 Jul 2 10:58 net
> dr-x--x--x 2 root root 0 Jul 2 10:58 ns
> ...
> dr-xr-xr-x 3 uucp wheel 0 Jul 2 10:58 task
>
> I checked the pre_revalidate and found the owner of the files under /proc/<pid>
> will be set to the GLOBAL_ROOT_UID if the task executed setuid/setgid(task_dumpable is false).
> Is this what we expected? why?
Expected yes. Perfect perhaps not.
That piece of code has not been examined to see if it is safe to use
make_kuid(task_user_ns(task), 0), instead of GLOBAL_ROOT_UID.
> For user namespace,the owner of /proc/1/* is incorrect and
> after task call setuid/gid in user namespace, the owner of /proc/<pid-of-this-task>/* is incorrect
> too.
From the current semantics of dumpable GLOBAL_ROOT_UID is correct.
Please double check but I believe /proc/self should continue to work,
despite this.
The practical question is there anything that can go wrong if we allow
the root of the user namespace of the process to read it. Especially
since several permission changes can happen a process may stop being
dumpable before we enter the user namespace. So it is not immediately
clear that relaxing the dumpable rules is safe.
Eric
next prev parent reply other threads:[~2013-07-02 8:44 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-01 16:16 Interaction user namespace, /proc/1 ownership & cap_set Daniel P. Berrange
[not found] ` <20130701161625.GQ15954-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-07-01 16:19 ` Daniel P. Berrange
[not found] ` <20130701161946.GR15954-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-07-01 16:24 ` Richard Weinberger
2013-07-02 5:14 ` Gao feng
[not found] ` <51D261D3.3030002-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
2013-07-02 8:44 ` Eric W. Biederman [this message]
[not found] ` <87wqp9uz9a.fsf-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
2013-07-02 8:56 ` Richard Weinberger
[not found] ` <51D295C5.1080003-/L3Ra7n9ekc@public.gmane.org>
2013-07-02 9:25 ` Daniel P. Berrange
[not found] ` <20130702092554.GD2524-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-07-02 9:45 ` Richard Weinberger
2013-07-02 9:57 ` Eric W. Biederman
[not found] ` <87ehbhthbl.fsf-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
2013-07-02 10:07 ` Gao feng
[not found] ` <51D2A649.9030102-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
2013-07-02 16:35 ` Eric W. Biederman
[not found] ` <8761wsudgk.fsf-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
2013-07-02 16:45 ` Daniel P. Berrange
[not found] ` <20130702164514.GB2524-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-07-02 17:12 ` Eric W. Biederman
[not found] ` <87k3l8sx6l.fsf-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
2013-07-02 20:24 ` Richard Weinberger
2013-07-09 10:35 ` Richard Weinberger
2013-07-12 10:04 ` Daniel P. Berrange
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=87wqp9uz9a.fsf@xmission.com \
--to=ebiederm-as9lmozglivwk0htik3j/w@public.gmane.org \
--cc=containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
--cc=gaofeng-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org \
--cc=richard-/L3Ra7n9ekc@public.gmane.org \
--cc=serge.hallyn-GeWIH/nMZzLQT0dZR+AlfA@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 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.