linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jann Horn <jann@thejh.net>
To: "Serge E. Hallyn" <serge.hallyn@ubuntu.com>
Cc: lkml <linux-kernel@vger.kernel.org>,
	Andrew Morgan <morgan@kernel.org>,
	Andy Lutomirski <luto@amacapital.net>,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	lxc-devel@lists.linuxcontainers.org,
	Richard Weinberger <richard@nod.at>,
	LSM <linux-security-module@vger.kernel.org>,
	linux-api@vger.kernel.org, keescook@chromium.org
Subject: Re: [PATCH RFC] Introduce new security.nscapability xattr
Date: Wed, 20 Jan 2016 13:14:52 +0100	[thread overview]
Message-ID: <20160120121452.GA32379@pc.thejh.net> (raw)
In-Reply-To: <20151130224356.GA27972@mail.hallyn.com>

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

On Mon, Nov 30, 2015 at 04:43:56PM -0600, Serge E. Hallyn wrote:
> +int get_vfs_ns_caps_from_disk(const struct dentry *dentry, struct cpu_vfs_cap_data *cpu_caps)
> +{
[...]
> +	/* find an applicable entry */
> +	/* a global entry (uid == -1) takes precedence */
> +	current_root = make_kuid(current_user_ns(), 0);
> +	if (!uid_valid(current_root)) {
> +		/* no root user in this namespace;  no capabilities */
> +		ret = -EINVAL;
> +		goto out;
> +	}
> +
> +	for (i = 0, cap = (void *) hdr + sizeof(*hdr); i < ncaps; cap += sizeof(*cap), i++) {
> +		uid_t uid = le32_to_cpu(cap->rootid);
> +		if (uid == -1) {
> +			nscap = cap;
> +			break;
> +		}
> +
> +		caprootuid = make_kuid(&init_user_ns, uid);
> +		if (uid_eq(caprootuid, current_root))
> +			nscap = cap;
> +	}

Wouldn't it be more consistent to check against the root uids of all parent
namespaces until one matches?

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

      parent reply	other threads:[~2016-01-20 12:14 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-30 22:43 [PATCH RFC] Introduce new security.nscapability xattr Serge E. Hallyn
2015-11-30 23:08 ` Eric W. Biederman
2015-12-01  3:51   ` Serge E. Hallyn
2015-12-04 20:21   ` Serge E. Hallyn
2016-01-19  7:09     ` Serge E. Hallyn
2016-01-20 12:48     ` Jann Horn
2016-01-27 16:08       ` Serge E. Hallyn
2016-01-27 17:22         ` Jann Horn
2016-01-28  0:36           ` Andy Lutomirski
2016-01-29  7:31             ` Serge E. Hallyn
2016-02-29 21:38               ` Serge E. Hallyn
2016-03-02  0:00                 ` Serge E. Hallyn
2016-01-20 12:14 ` Jann Horn [this message]

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=20160120121452.GA32379@pc.thejh.net \
    --to=jann@thejh.net \
    --cc=ebiederm@xmission.com \
    --cc=keescook@chromium.org \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=lxc-devel@lists.linuxcontainers.org \
    --cc=morgan@kernel.org \
    --cc=richard@nod.at \
    --cc=serge.hallyn@ubuntu.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;
as well as URLs for NNTP newsgroup(s).