lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Tue, 9 Dec 2014 14:49:32 -0800 From: Andy Lutomirski <luto@...capital.net> To: "Eric W. Biederman" <ebiederm@...ssion.com> Cc: Linux Containers <containers@...ts.linux-foundation.org>, Josh Triplett <josh@...htriplett.org>, Andrew Morton <akpm@...ux-foundation.org>, Kees Cook <keescook@...omium.org>, Michael Kerrisk-manpages <mtk.manpages@...il.com>, Linux API <linux-api@...r.kernel.org>, linux-man <linux-man@...r.kernel.org>, "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>, LSM <linux-security-module@...r.kernel.org>, Casey Schaufler <casey@...aufler-ca.com>, "Serge E. Hallyn" <serge@...lyn.com>, Richard Weinberger <richard@....at>, Kenton Varda <kenton@...dstorm.io>, stable <stable@...r.kernel.org> Subject: Re: [CFT][PATCH 6/8] userns: Rename id_map_mutex to userns_state_mutex On Tue, Dec 9, 2014 at 12:41 PM, Eric W. Biederman <ebiederm@...ssion.com> wrote: > > Generalize id_map_mutex so it can be used for more state of a user namespace. Reviewed-by: Andy Lutomirski <luto@...capital.net> > > Cc: stable@...r.kernel.org > Signed-off-by: "Eric W. Biederman" <ebiederm@...ssion.com> > --- > kernel/user_namespace.c | 14 ++++++-------- > 1 file changed, 6 insertions(+), 8 deletions(-) > > diff --git a/kernel/user_namespace.c b/kernel/user_namespace.c > index 1e34de2fbd60..44a555ac6104 100644 > --- a/kernel/user_namespace.c > +++ b/kernel/user_namespace.c > @@ -24,6 +24,7 @@ > #include <linux/fs_struct.h> > > static struct kmem_cache *user_ns_cachep __read_mostly; > +static DEFINE_MUTEX(userns_state_mutex); > > static bool new_idmap_permitted(const struct file *file, > struct user_namespace *ns, int cap_setid, > @@ -583,9 +584,6 @@ static bool mappings_overlap(struct uid_gid_map *new_map, > return false; > } > > - > -static DEFINE_MUTEX(id_map_mutex); > - > static ssize_t map_write(struct file *file, const char __user *buf, > size_t count, loff_t *ppos, > int cap_setid, > @@ -602,7 +600,7 @@ static ssize_t map_write(struct file *file, const char __user *buf, > ssize_t ret = -EINVAL; > > /* > - * The id_map_mutex serializes all writes to any given map. > + * The userns_state_mutex serializes all writes to any given map. > * > * Any map is only ever written once. > * > @@ -620,7 +618,7 @@ static ssize_t map_write(struct file *file, const char __user *buf, > * order and smp_rmb() is guaranteed that we don't have crazy > * architectures returning stale data. > */ > - mutex_lock(&id_map_mutex); > + mutex_lock(&userns_state_mutex); > > ret = -EPERM; > /* Only allow one successful write to the map */ > @@ -750,7 +748,7 @@ static ssize_t map_write(struct file *file, const char __user *buf, > *ppos = count; > ret = count; > out: > - mutex_unlock(&id_map_mutex); > + mutex_unlock(&userns_state_mutex); > if (page) > free_page(page); > return ret; > @@ -845,12 +843,12 @@ bool userns_may_setgroups(const struct user_namespace *ns) > { > bool allowed; > > - mutex_lock(&id_map_mutex); > + mutex_lock(&userns_state_mutex); > /* It is not safe to use setgroups until a gid mapping in > * the user namespace has been established. > */ > allowed = ns->gid_map.nr_extents != 0; > - mutex_unlock(&id_map_mutex); > + mutex_unlock(&userns_state_mutex); > > return allowed; > } > -- > 1.9.1 > -- Andy Lutomirski AMA Capital Management, LLC -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@...r.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists