From: ebiederm@xmission.com (Eric W. Biederman)
To: Stefan Berger <stefanb@linux.vnet.ibm.com>
Cc: containers@lists.linux-foundation.org, lkp@01.org,
linux-kernel@vger.kernel.org, zohar@linux.vnet.ibm.com,
tycho@docker.com, serge@hallyn.com,
James.Bottomley@HansenPartnership.com, vgoyal@redhat.com,
christian.brauner@mailbox.org, amir73il@gmail.com,
linux-security-module@vger.kernel.org, casey@schaufler-ca.com,
Stefan Berger <stefanb@linux.vnet.ibm.com>
Subject: Re: [PATCH v2] xattr: Enable security.capability in user namespaces
Date: Wed, 12 Jul 2017 08:25:29 -0500 [thread overview]
Message-ID: <87mv89iy7q.fsf@xmission.com> (raw)
In-Reply-To: <1499785511-17192-2-git-send-email-stefanb@linux.vnet.ibm.com> (Stefan Berger's message of "Tue, 11 Jul 2017 11:05:11 -0400")
Stefan Berger <"Stefan Bergerstefanb"@linux.vnet.ibm.com> writes:
> From: Stefan Berger <stefanb@linux.vnet.ibm.com>
>
> This patch enables security.capability in user namespaces but also
> takes a more general approach to enabling extended attributes in user
> namespaces.
>
> The following rules describe the approach using security.foo as a
> 'user namespace enabled' extended attribute:
>
> Reading of extended attributes:
>
> 1a) Reading security.foo from a user namespace will read
> security.foo@uid=<uid> of the parent user namespace instead with uid
> being the mapping of root in that parent user namespace. An
> exception is if root is mapped to uid 0 on the host, and in this case
> we will read security.foo directly.
> --> reading security.foo will read security.foo@uid=1000 for uid
> mapping of root to 1000.
>
> 1b) If security.foo@uid=<uid> is not available, the security.foo of the
> parent namespace is tried to be read. This procedure is repeated up to
> the init user namespace. This step only applies for reading of extended
> attributes and provides the same behavior as older system where the
> host's extended attributes applied to user namespaces.
>
> 2) All security.foo@uid=<uid> with valid uid mapping in the user namespace
> can be read. The uid within the user namespace will be mapped to the
> corresponding uid on the host and that uid will be used in the name of
> the extended attribute.
> -> reading security.foo@uid=1 will read security.foo@uid=1001 for uid
> mapping of root to 1000, size of at least 2.
>
> All security.foo@uid=<uid> can be read (by root) on the host with values
> of <uid> also being subject to checking for valid mappings.
>
> 3) No other security.foo* can be read.
>
> The same rules for reading apply to writing and removing of user
> namespace enabled extended attributes.
>
> When listing extended attributes of a file, only those are presented
> to the user namespace that have a valid mapping. Besides that, names
> of the extended attributes are adjusted to represent the mapping.
> This means that if root is mapped to uid 1000 on the host, the
> security.foo@uid=1000 will be listed as security.foo in the user
> namespace, security.foo@uid=1001 becomes security.foo@uid=1 and so on.
>
> Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
> Signed-off-by: Serge Hallyn <serge@hallyn.com>
> Reviewed-by: Serge Hallyn <serge@hallyn.com>
It doesn't look like this is coming through Serge so I don't see how
the Signed-off-by tag is legtimate.
>From the replies to this it doesn't look like Serge has reviewed this
version either.
I am disappointed that all of my concerns about technical feasibility
remain unaddressed.
I hope my reading and review of the code goes better than my reading of
it's introduction.
Eric
> ---
> fs/xattr.c | 509 +++++++++++++++++++++++++++++++++++++++++++++--
> security/commoncap.c | 36 +++-
> security/selinux/hooks.c | 9 +-
> 3 files changed, 523 insertions(+), 31 deletions(-)
>
> diff --git a/fs/xattr.c b/fs/xattr.c
> index 464c94b..eacad9e 100644
> --- a/fs/xattr.c
> +++ b/fs/xattr.c
> @@ -133,20 +133,440 @@ xattr_permission(struct inode *inode, const char *name, int mask)
> return inode_permission(inode, mask);
> }
>
> +/*
> + * A list of extended attributes that are supported in user namespaces
> + */
> +static const char *const userns_xattrs[] = {
> + XATTR_NAME_CAPS,
> + NULL
> +};
> +
> +/*
> + * xattrs_is_userns_supported - Check whether an xattr is supported in userns
> + *
> + * @name: full name of the extended attribute
> + * @prefix: do a prefix match (true) or a full match (false)
> + *
> + * This function returns < 0 if not supported, an index into userns_xattrs[]
> + * otherwise.
> + */
> +static int
> +xattr_is_userns_supported(const char *name, int prefix)
> +{
> + int i;
> +
> + if (!name)
> + return -1;
> +
> + for (i = 0; userns_xattrs[i]; i++) {
> + if (prefix) {
> + if (!strncmp(userns_xattrs[i], name,
> + strlen(userns_xattrs[i])))
> + return i;
> + } else {
> + if (!strcmp(userns_xattrs[i], name))
> + return i;
> + }
> + }
> + return -1;
> +}
> +
> +/*
> + * xattr_write_uid - print a string in the format of "%s@uid=%u", which
> + * includes a prefix string
> + *
> + * @uid: the uid
> + * @prefix: prefix string; may be NULL
> + *
> + * This function returns a buffer with the string, or a NULL pointer in
> + * case of out-of-memory error.
> + */
> +static char *
> +xattr_write_uid(uid_t uid, const char *prefix)
> +{
> + size_t buflen;
> + char *buffer;
> +
> + buflen = sizeof("@uid=") - 1 + sizeof("4294967295") - 1 + 1;
> + if (prefix)
> + buflen += strlen(prefix);
> +
> + buffer = kmalloc(buflen, GFP_KERNEL);
> + if (!buffer)
> + return NULL;
> +
> + if (uid == 0)
> + *buffer = 0;
> + else
> + sprintf(buffer, "%s@uid=%u",
> + (prefix) ? prefix : "",
> + uid);
> +
> + return buffer;
> +}
> +
> +/*
> + * xattr_parse_uid_from_kuid - parse string in the format @uid=<uid>; consider
> + * user namespaces and check mappings
> + *
> + * @uidstr : string in the format "@uid=<uid>"
> + * @userns : the user namespace to consult for uid mappings
> + * @n_uidstr : returned pointer holding the rewritten @uid=<uid> string with
> + * the uid remapped
> + *
> + * This function returns an error code or 0 in case of success. In case
> + * of success, 'n_uidstr' will hold a valid string.
> + */
> +static int
> +xattr_parse_uid_from_kuid(const char *uidstr, struct user_namespace *userns,
> + char **n_uidstr)
> +{
> + int n;
> + uid_t muid, p_uid;
> + char d;
> + kuid_t tuid;
> +
> + *n_uidstr = NULL;
> +
> + n = sscanf(uidstr, "@uid=%u%c", &p_uid, &d);
> + if (n != 1)
> + return -EINVAL;
> +
> + /* do we have a mapping of the uid? */
> + tuid = KUIDT_INIT(p_uid);
> + muid = from_kuid(userns, tuid);
> + if (muid == -1)
> + return -ENOENT;
> +
> + *n_uidstr = xattr_write_uid(muid, NULL);
> + if (!*n_uidstr)
> + return -ENOMEM;
> +
> + return 0;
> +}
> +
> +/*
> + * xattr_parse_uid_make_kuid - parse string in the format @uid=<uid>; consider
> + * user namespaces and check mappings
> + *
> + * @uidstr : string in the format "@uid=<uid>"
> + * @userns : the user namespace to consult for uid mappings
> + * @N_uidstr : returned pointer holding the rewritten @uid=<uid> string with
> + * the uid remapped
> + *
> + * This function returns an error code or 0 in case of success. In case
> + * of success, 'n_uidstr' will hold a valid string.
> + */
> +static int
> +xattr_parse_uid_make_kuid(const char *uidstr, struct user_namespace *userns,
> + char **n_uidstr)
> +{
> + int n;
> + uid_t p_uid;
> + char d;
> + kuid_t tuid;
> +
> + *n_uidstr = NULL;
> +
> + n = sscanf(uidstr, "@uid=%u%c", &p_uid, &d);
> + if (n != 1)
> + return -EINVAL;
> +
> + tuid = make_kuid(userns, p_uid);
> + if (!uid_valid(tuid))
> + return -ENOENT;
> +
> + *n_uidstr = xattr_write_uid(__kuid_val(tuid), NULL);
> + if (!*n_uidstr)
> + return -ENOMEM;
> +
> + return 0;
> +}
> +
> +/*
> + * xattr_rewrite_userns_xattr - Rewrite and filter an extended attribute
> + * considering user namespace uid mappings and
> + * user namespace support extended attributes
> + *
> + * @name: full name of the extended attribute
> + *
> + * This function returns NULL if the name is to be filtered. Otherwise it can
> + * return the input buffer or a new buffer that the caller needs to free. The
> + * new buffer contains a rewritten extended attribute whose string length may
> + * exceed that of the given name.
> + */
> +static char *
> +xattr_rewrite_userns_xattr(char *name)
> +{
> + int idx, error;
> + size_t len = 0, buflen;
> + char *buffer, *n_uidstr;
> +
> + /* prefix-match name against supported attributes */
> + idx = xattr_is_userns_supported(name, true);
> + if (idx < 0) {
> + /* only rewrite those in userns_xattr[*] */
> + return name;
> + }
> +
> + /* exact match ? */
> + len = strlen(userns_xattrs[idx]);
> + if (name[len] == 0)
> + return NULL;
> +
> + /*
> + * We must have a name[len] == '@'.
> + */
> + error = xattr_parse_uid_from_kuid(&name[len], current_user_ns(),
> + &n_uidstr);
> + if (error)
> + return NULL;
> +
> + buflen = len + strlen(n_uidstr) + 1;
> + buffer = kmalloc(buflen, GFP_KERNEL);
> + if (!buffer) {
> + kfree(n_uidstr);
> + return ERR_PTR(-ENOMEM);
> + }
> +
> + name[len] = 0;
> +
> + snprintf(buffer, buflen, "%s%s", name, n_uidstr);
> +
> + name[len] = '@';
> +
> + kfree(n_uidstr);
> +
> + return buffer;
> +}
> +
> +/*
> + * xattr_list_contains - check whether an xattr list already contains a needle
> + *
> + * @list : 0-byte separated strings
> + * @listlen : length of the list
> + * @needle : the needle to search for
> + */
> +static int
> +xattr_list_contains(const char *list, size_t listlen, const char *needle)
> +{
> + size_t o = 0;
> +
> + while (o < listlen) {
> + if (!strcmp(&list[o], needle))
> + return true;
> + o += strlen(&list[o]) + 1;
> + }
> + return false;
> +}
> +
> +/*
> + * xattr_list_userns_rewrite - Rewrite list of xattr names for user namespaces
> + * or determine needed size for attribute list
> + * in case size == 0
> + *
> + * In a user namespace we do not present all extended attributes to the
> + * user. We filter out those that are in the list of userns supported xattr.
> + * Besides that we filter out those with @uid=<uid> when there is no mapping
> + * for that uid in the current user namespace.
> + *
> + * @list: list of 0-byte separated xattr names
> + * @size: the size of the list; may be 0 to determine needed list size
> + * @list_maxlen: allocated buffer size of list
> + */
> +static ssize_t
> +xattr_list_userns_rewrite(char *list, ssize_t size, size_t list_maxlen)
> +{
> + char *nlist = NULL;
> + size_t s_off, len, nlen;
> + ssize_t d_off;
> + char *name, *newname;
> +
> + if (!list || size < 0 || current_user_ns() == &init_user_ns)
> + return size;
> +
> + if (size) {
> + nlist = kmalloc(list_maxlen, GFP_KERNEL);
> + if (!nlist)
> + return -ENOMEM;
> + }
> +
> + s_off = d_off = 0;
> + while (s_off < size || size == 0) {
> + name = &list[s_off];
> +
> + len = strlen(name);
> + if (!len)
> + break;
> +
> + if (xattr_is_userns_supported(name, false) >= 0)
> + newname = name;
> + else {
> + newname = xattr_rewrite_userns_xattr(name);
> + if (IS_ERR(newname)) {
> + d_off = PTR_ERR(newname);
> + goto out_free;
> + }
> + }
> + if (newname && !xattr_list_contains(nlist, d_off, newname)) {
> + nlen = strlen(newname);
> +
> + if (nlist) {
> + if (nlen + 1 > list_maxlen)
> + break;
> + strcpy(&nlist[d_off], newname);
> + }
> +
> + d_off += nlen + 1;
> + if (newname != name)
> + kfree(newname);
> + }
> + s_off += len + 1;
> + }
> + if (nlist)
> + memcpy(list, nlist, d_off);
> +out_free:
> + kfree(nlist);
> +
> + return d_off;
> +}
> +
> +/*
> + * xattr_userns_name - modify the name of a user namespace supported
> + * extended attribute
> + *
> + * In a user namespace we prevent read/write accesses to the host's
> + * security.foo to protect these extended attributes.
> + *
> + * Reading:
> + * 1a) Reading security.foo from a user namespace will read
> + * security.foo@uid=<uid> of the parent user namespace instead with uid
> + * being the mapping of root in that parent user namespace. An
> + * exception is if root is mapped to uid 0 on the host, and in this case
> + * we will read security.foo directly.
> + * -> reading security.foo will read security.foo@uid=1000 for a uid
> + * mapping of root to 1000.
> + *
> + * 1b) If security.foo@uid=<uid> is not available, the security.foo of the
> + * parent namespace is tried to be read. This procedure is repeated up to
> + * the init user namespace. This step only applies for reading of extended
> + * attributes and provides the same behavior as older systems where the
> + * host's extended attributes applied to user namespaces.
> + *
> + * 2) All security.foo@uid=<uid> with valid uid mappings in the user namespace
> + * an be read. The uid within the user namespace will be mapped to the
> + * corresponding uid on the host and that uid will be used in the name of
> + * the extended attribute.
> + * -> reading security.foo@uid=1 will read security.foo@uid=1001 for a uid
> + * mapping of root to 1000, size of at least 2.
> + *
> + * All security.foo@uid=<uid> can be read (by root) on the host with values
> + * of <uid> also being subject to checking for valid mappings.
> + *
> + * 3) No other security.foo* can be read.
> + *
> + * Writing and removing:
> + * The same rules for reading apply to writing and removing, except for 1b).
> + *
> + * This function returns a buffer with either the original name or the
> + * user namespace adjusted name of the extended attribute.
> + *
> + * @name: the full name of the extended attribute, e.g. security.foo
> + */
> +char *
> +xattr_userns_name(const char *name, struct user_namespace *userns)
> +{
> + size_t buflen;
> + char *buffer, *n_uidstr;
> + kuid_t root_uid = make_kuid(userns, 0);
> + int idx, error;
> + size_t len;
> +
> + /* only security.foo will be changed here - prefix match here */
> + idx = xattr_is_userns_supported(name, true);
> + if (idx < 0)
> + goto out_copy;
> +
> + /* read security.foo? --> read security.foo@uid=<uid> instead */
> + len = strlen(userns_xattrs[idx]);
> + if (name[len] == 0) {
> + /*
> + * init_user_ns or userns with root mapped to uid 0
> + * may read security.foo directly
> + */
> + if (userns == &init_user_ns ||
> + __kuid_val(root_uid) == 0)
> + goto out_copy;
> +
> + if (!uid_valid(root_uid))
> + return ERR_PTR(-EINVAL);
> +
> + buffer = xattr_write_uid(__kuid_val(root_uid), name);
> + if (!buffer)
> + return ERR_PTR(-ENOMEM);
> +
> + return buffer;
> + }
> +
> + /*
> + * We must have name[len] == '@'.
> + */
> + error = xattr_parse_uid_make_kuid(&name[len],
> + userns,
> + &n_uidstr);
> + if (error)
> + return ERR_PTR(error);
> +
> + /* name[len] == '@' */
> + buflen = len + strlen(n_uidstr) + 1;
> + buffer = kmalloc(buflen, GFP_KERNEL);
> + if (!buffer) {
> + kfree(n_uidstr);
> + return ERR_PTR(-ENOMEM);
> + }
> +
> + snprintf(buffer, len + 1, "%s", name);
> + snprintf(&buffer[len], buflen - len, "%s", n_uidstr);
> + kfree(n_uidstr);
> +
> + return buffer;
> +
> +out_copy:
> + buffer = kstrdup(name, GFP_KERNEL);
> + if (!buffer)
> + return ERR_PTR(-ENOMEM);
> +
> + return buffer;
> +}
> +
> int
> __vfs_setxattr(struct dentry *dentry, struct inode *inode, const char *name,
> const void *value, size_t size, int flags)
> {
> const struct xattr_handler *handler;
> + char *newname;
> + int ret;
>
> + newname = xattr_userns_name(name, current_user_ns());
> + if (IS_ERR(newname))
> + return PTR_ERR(newname);
> + name = newname;
> handler = xattr_resolve_name(inode, &name);
> - if (IS_ERR(handler))
> - return PTR_ERR(handler);
> - if (!handler->set)
> - return -EOPNOTSUPP;
> + if (IS_ERR(handler)) {
> + ret = PTR_ERR(handler);
> + goto out;
> + }
> + if (!handler->set) {
> + ret = -EOPNOTSUPP;
> + goto out;
> + }
> if (size == 0)
> value = ""; /* empty EA, do not remove */
> - return handler->set(handler, dentry, inode, name, value, size, flags);
> + ret = handler->set(handler, dentry, inode, name, value, size, flags);
> +
> +out:
> + kfree(newname);
> + return ret;
> }
> EXPORT_SYMBOL(__vfs_setxattr);
>
> @@ -301,14 +721,39 @@ ssize_t
> __vfs_getxattr(struct dentry *dentry, struct inode *inode, const char *name,
> void *value, size_t size)
> {
> - const struct xattr_handler *handler;
> + const struct xattr_handler *handler = NULL;
> + char *newname = NULL;
> + int ret, userns_supt_xattr;
> + struct user_namespace *userns = current_user_ns();
> +
> + userns_supt_xattr = (xattr_is_userns_supported(name, false) >= 0);
> +
> + do {
> + kfree(newname);
> +
> + newname = xattr_userns_name(name, userns);
> + if (IS_ERR(newname))
> + return PTR_ERR(newname);
> +
> + if (!handler) {
> + name = newname;
> + handler = xattr_resolve_name(inode, &name);
> + if (IS_ERR(handler)) {
> + ret = PTR_ERR(handler);
> + goto out;
> + }
> + if (!handler->get) {
> + ret = -EOPNOTSUPP;
> + goto out;
> + }
> + }
> + ret = handler->get(handler, dentry, inode, name, value, size);
> + userns = userns->parent;
> + } while ((ret == -ENODATA) && userns && userns_supt_xattr);
>
> - handler = xattr_resolve_name(inode, &name);
> - if (IS_ERR(handler))
> - return PTR_ERR(handler);
> - if (!handler->get)
> - return -EOPNOTSUPP;
> - return handler->get(handler, dentry, inode, name, value, size);
> +out:
> + kfree(newname);
> + return ret;
> }
> EXPORT_SYMBOL(__vfs_getxattr);
>
> @@ -328,8 +773,16 @@ vfs_getxattr(struct dentry *dentry, const char *name, void *value, size_t size)
>
> if (!strncmp(name, XATTR_SECURITY_PREFIX,
> XATTR_SECURITY_PREFIX_LEN)) {
> - const char *suffix = name + XATTR_SECURITY_PREFIX_LEN;
> - int ret = xattr_getsecurity(inode, suffix, value, size);
> + int ret;
> + const char *suffix;
> + char *newname = xattr_userns_name(name, current_user_ns());
> + if (IS_ERR(newname))
> + return PTR_ERR(newname);
> +
> + suffix = newname + XATTR_SECURITY_PREFIX_LEN;
> +
> + ret = xattr_getsecurity(inode, suffix, value, size);
> + kfree(newname);
> /*
> * Only overwrite the return value if a security module
> * is actually active.
> @@ -360,6 +813,9 @@ vfs_listxattr(struct dentry *dentry, char *list, size_t size)
> if (size && error > size)
> error = -ERANGE;
> }
> + if (error > 0)
> + error = xattr_list_userns_rewrite(list, error, size);
> +
> return error;
> }
> EXPORT_SYMBOL_GPL(vfs_listxattr);
> @@ -369,13 +825,28 @@ __vfs_removexattr(struct dentry *dentry, const char *name)
> {
> struct inode *inode = d_inode(dentry);
> const struct xattr_handler *handler;
> + char *newname;
> + int ret;
>
> + newname = xattr_userns_name(name, current_user_ns());
> + if (IS_ERR(newname))
> + return PTR_ERR(newname);
> + name = newname;
> handler = xattr_resolve_name(inode, &name);
> - if (IS_ERR(handler))
> - return PTR_ERR(handler);
> - if (!handler->set)
> - return -EOPNOTSUPP;
> - return handler->set(handler, dentry, inode, name, NULL, 0, XATTR_REPLACE);
> + if (IS_ERR(handler)) {
> + ret = PTR_ERR(handler);
> + goto out;
> + }
> + if (!handler->set) {
> + ret = -EOPNOTSUPP;
> + goto out;
> + }
> + ret = handler->set(handler, dentry, inode, name, NULL, 0, XATTR_REPLACE);
> +
> +out:
> + kfree(newname);
> +
> + return ret;
> }
> EXPORT_SYMBOL(__vfs_removexattr);
>
> diff --git a/security/commoncap.c b/security/commoncap.c
> index 7abebd7..c842690 100644
> --- a/security/commoncap.c
> +++ b/security/commoncap.c
> @@ -660,15 +660,23 @@ int cap_bprm_secureexec(struct linux_binprm *bprm)
> int cap_inode_setxattr(struct dentry *dentry, const char *name,
> const void *value, size_t size, int flags)
> {
> - if (!strcmp(name, XATTR_NAME_CAPS)) {
> - if (!capable(CAP_SETFCAP))
> + if (strncmp(name, XATTR_SECURITY_PREFIX,
> + sizeof(XATTR_SECURITY_PREFIX) - 1) != 0)
> + return 0;
> +
> + if (strncmp(name, XATTR_NAME_CAPS,
> + sizeof(XATTR_NAME_CAPS) - 1) == 0) {
> + struct inode *inode = d_backing_inode(dentry);
> +
> + if (!inode)
> + return -EINVAL;
> + if (!capable_wrt_inode_uidgid(inode, CAP_SETFCAP))
> return -EPERM;
> +
> return 0;
> }
>
> - if (!strncmp(name, XATTR_SECURITY_PREFIX,
> - sizeof(XATTR_SECURITY_PREFIX) - 1) &&
> - !capable(CAP_SYS_ADMIN))
> + if (!capable(CAP_SYS_ADMIN))
> return -EPERM;
> return 0;
> }
> @@ -686,15 +694,23 @@ int cap_inode_setxattr(struct dentry *dentry, const char *name,
> */
> int cap_inode_removexattr(struct dentry *dentry, const char *name)
> {
> - if (!strcmp(name, XATTR_NAME_CAPS)) {
> - if (!capable(CAP_SETFCAP))
> + if (strncmp(name, XATTR_SECURITY_PREFIX,
> + sizeof(XATTR_SECURITY_PREFIX) - 1) != 0)
> + return 0;
> +
> + if (strncmp(name, XATTR_NAME_CAPS,
> + sizeof(XATTR_NAME_CAPS) - 1) == 0) {
> + struct inode *inode = d_backing_inode(dentry);
> +
> + if (!inode)
> + return -EINVAL;
> + if (!capable_wrt_inode_uidgid(inode, CAP_SETFCAP))
> return -EPERM;
> +
> return 0;
> }
>
> - if (!strncmp(name, XATTR_SECURITY_PREFIX,
> - sizeof(XATTR_SECURITY_PREFIX) - 1) &&
> - !capable(CAP_SYS_ADMIN))
> + if (!capable(CAP_SYS_ADMIN))
> return -EPERM;
> return 0;
> }
> diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
> index 819fd68..702c225 100644
> --- a/security/selinux/hooks.c
> +++ b/security/selinux/hooks.c
> @@ -3091,8 +3091,13 @@ static int selinux_inode_setotherxattr(struct dentry *dentry, const char *name)
>
> if (!strncmp(name, XATTR_SECURITY_PREFIX,
> sizeof XATTR_SECURITY_PREFIX - 1)) {
> - if (!strcmp(name, XATTR_NAME_CAPS)) {
> - if (!capable(CAP_SETFCAP))
> + if (!strncmp(name, XATTR_NAME_CAPS,
> + sizeof(XATTR_NAME_CAPS) - 1)) {
> + struct inode *inode = d_backing_inode(dentry);
> +
> + if (!inode)
> + return -EINVAL;
> + if (!capable_wrt_inode_uidgid(inode, CAP_SETFCAP))
> return -EPERM;
> } else if (!capable(CAP_SYS_ADMIN)) {
> /* A different attribute in the security namespace.
next prev parent reply other threads:[~2017-07-12 13:33 UTC|newest]
Thread overview: 76+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-11 15:05 [PATCH v2] Enable namespaced file capabilities Stefan Berger
2017-07-11 15:05 ` [PATCH v2] xattr: Enable security.capability in user namespaces Stefan Berger
2017-07-11 17:12 ` Serge E. Hallyn
2017-07-12 0:15 ` Stefan Berger
2017-07-12 0:47 ` Serge E. Hallyn
2017-07-12 3:45 ` Serge E. Hallyn
2017-07-12 11:35 ` Stefan Berger
2017-07-12 17:32 ` Serge E. Hallyn
2017-07-12 7:59 ` James Morris
2017-07-12 13:25 ` Eric W. Biederman [this message]
2017-07-12 17:03 ` Serge E. Hallyn
2017-07-12 22:20 ` James Morris
2017-07-13 0:33 ` Eric W. Biederman
2017-07-13 1:01 ` Serge E. Hallyn
2017-07-12 23:13 ` Eric W. Biederman
2017-07-13 0:43 ` Serge E. Hallyn
2017-07-13 0:44 ` Stefan Berger
2017-07-13 1:15 ` Theodore Ts'o
2017-07-13 2:34 ` Serge E. Hallyn
2017-07-13 12:11 ` Eric W. Biederman
2017-07-13 16:40 ` Theodore Ts'o
2017-07-13 17:05 ` Stefan Berger
2017-07-13 17:39 ` Eric W. Biederman
2017-07-13 19:14 ` Theodore Ts'o
2017-07-13 19:41 ` Serge E. Hallyn
2017-07-13 21:17 ` Serge E. Hallyn
2017-07-18 7:01 ` James Morris
2017-07-18 12:12 ` Stefan Berger
2017-07-18 13:26 ` Eric W. Biederman
2017-07-18 23:13 ` Serge E. Hallyn
2017-07-13 17:14 ` Eric W. Biederman
2017-07-13 17:33 ` Stefan Berger
2017-07-13 17:49 ` Eric W. Biederman
2017-07-13 19:48 ` Serge E. Hallyn
2017-07-13 21:12 ` Eric W. Biederman
[not found] ` <9a3010e5-ca2b-5e7a-656b-fcc14f7bec4e@linux.vnet.ibm.com>
2017-07-14 0:38 ` Eric W. Biederman
2017-07-14 11:32 ` Stefan Berger
2017-07-14 12:04 ` Eric W. Biederman
2017-07-14 12:39 ` Stefan Berger
2017-07-14 13:34 ` Serge E. Hallyn
2017-07-14 15:22 ` Stefan Berger
2017-07-14 17:35 ` Serge E. Hallyn
2017-07-14 18:17 ` Eric W. Biederman
2017-07-14 18:48 ` Mimi Zohar
2017-07-14 18:52 ` James Bottomley
2017-07-14 20:03 ` Mimi Zohar
2017-07-14 20:39 ` James Bottomley
2017-07-14 21:34 ` Theodore Ts'o
2017-07-14 23:22 ` Eric W. Biederman
2017-07-14 23:29 ` Mimi Zohar
2017-07-14 23:53 ` Eric W. Biederman
2017-07-14 19:29 ` Theodore Ts'o
2017-07-14 19:43 ` Mimi Zohar
[not found] ` <xagsmtp2.20170714182525.6604@vmsdvm4.vnet.ibm.com>
2017-07-14 19:26 ` Mimi Zohar
2017-07-15 0:02 ` Eric W. Biederman
[not found] ` <xagsmtp3.20170715001054.9173@uk1vsc.vnet.ibm.com>
2017-07-16 11:25 ` Mimi Zohar
2017-07-26 3:00 ` Serge E. Hallyn
2017-07-26 13:57 ` Mimi Zohar
2017-07-14 17:36 ` Eric W. Biederman
2017-07-14 19:22 ` Stefan Berger
2017-07-13 21:21 ` Serge E. Hallyn
2017-07-13 21:13 ` Serge E. Hallyn
2017-07-12 17:53 ` Vivek Goyal
2017-07-12 19:19 ` Stefan Berger
2017-07-14 23:41 ` Eric W. Biederman
2017-07-15 21:27 ` Stefan Berger
2017-07-17 18:58 ` Vivek Goyal
2017-07-17 20:50 ` Stefan Berger
2017-07-18 11:48 ` Vivek Goyal
2017-07-18 12:05 ` Stefan Berger
2017-07-18 12:30 ` Vivek Goyal
2017-07-18 12:36 ` Vivek Goyal
2017-07-18 13:29 ` Eric W. Biederman
2017-07-18 13:21 ` Stefan Berger
2017-07-18 14:57 ` Vivek Goyal
2017-07-18 16:11 ` Stefan Berger
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=87mv89iy7q.fsf@xmission.com \
--to=ebiederm@xmission.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=amir73il@gmail.com \
--cc=casey@schaufler-ca.com \
--cc=christian.brauner@mailbox.org \
--cc=containers@lists.linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=lkp@01.org \
--cc=serge@hallyn.com \
--cc=stefanb@linux.vnet.ibm.com \
--cc=tycho@docker.com \
--cc=vgoyal@redhat.com \
--cc=zohar@linux.vnet.ibm.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