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
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120418184955.GE4984@mail.hallyn.com>
Date:	Wed, 18 Apr 2012 18:49:55 +0000
From:	"Serge E. Hallyn" <serge@...lyn.com>
To:	"Eric W. Beiderman" <ebiederm@...ssion.com>
Cc:	linux-kernel@...r.kernel.org,
	Linux Containers <containers@...ts.linux-foundation.org>,
	Cyrill Gorcunov <gorcunov@...nvz.org>,
	linux-security-module@...r.kernel.org,
	Al Viro <viro@...IV.linux.org.uk>,
	linux-fsdevel@...r.kernel.org,
	Andrew Morton <akpm@...ux-foundation.org>,
	Linus Torvalds <torvalds@...ux-foundation.org>
Subject: Re: [PATCH 20/43] userns: Replace user_ns_map_uid and
 user_ns_map_gid with from_kuid and from_kgid

Quoting Eric W. Beiderman (ebiederm@...ssion.com):
> From: Eric W. Biederman <ebiederm@...ssion.com>
> 
> These function are no longer needed replace them with their more useful equivalents.
> 
> Signed-off-by: Eric W. Biederman <ebiederm@...ssion.com>

Acked-by: Serge Hallyn <serge.hallyn@...onical.com>

> ---
>  include/linux/user_namespace.h |   12 ------------
>  ipc/mqueue.c                   |    3 +--
>  kernel/signal.c                |    2 +-
>  net/core/sock.c                |    4 ++--
>  4 files changed, 4 insertions(+), 17 deletions(-)
> 
> diff --git a/include/linux/user_namespace.h b/include/linux/user_namespace.h
> index a2c6145..4e72922 100644
> --- a/include/linux/user_namespace.h
> +++ b/include/linux/user_namespace.h
> @@ -69,16 +69,4 @@ static inline void put_user_ns(struct user_namespace *ns)
>  
>  #endif
>  
> -static inline uid_t user_ns_map_uid(struct user_namespace *to,
> -	const struct cred *cred, kuid_t uid)
> -{
> -	return from_kuid_munged(to, uid);
> -}
> -
> -static inline gid_t user_ns_map_gid(struct user_namespace *to,
> -	const struct cred *cred, kgid_t gid)
> -{
> -	return from_kgid_munged(to, gid);
> -}
> -
>  #endif /* _LINUX_USER_H */
> diff --git a/ipc/mqueue.c b/ipc/mqueue.c
> index b53cf34..b6a0d46 100644
> --- a/ipc/mqueue.c
> +++ b/ipc/mqueue.c
> @@ -538,8 +538,7 @@ static void __do_notify(struct mqueue_inode_info *info)
>  			rcu_read_lock();
>  			sig_i.si_pid = task_tgid_nr_ns(current,
>  						ns_of_pid(info->notify_owner));
> -			sig_i.si_uid = user_ns_map_uid(info->notify_user_ns,
> -						current_cred(), current_uid());
> +			sig_i.si_uid = from_kuid_munged(info->notify_user_ns, current_uid());
>  			rcu_read_unlock();
>  
>  			kill_pid_info(info->notify.sigev_signo,
> diff --git a/kernel/signal.c b/kernel/signal.c
> index 2734dc9..d630327 100644
> --- a/kernel/signal.c
> +++ b/kernel/signal.c
> @@ -1026,7 +1026,7 @@ static inline int legacy_queue(struct sigpending *signals, int sig)
>  static inline uid_t map_cred_ns(const struct cred *cred,
>  				struct user_namespace *ns)
>  {
> -	return user_ns_map_uid(ns, cred, cred->uid);
> +	return from_kuid_munged(ns, cred->uid);
>  }
>  
>  #ifdef CONFIG_USER_NS
> diff --git a/net/core/sock.c b/net/core/sock.c
> index b2e14c0..e1ec8ba 100644
> --- a/net/core/sock.c
> +++ b/net/core/sock.c
> @@ -821,8 +821,8 @@ void cred_to_ucred(struct pid *pid, const struct cred *cred,
>  	if (cred) {
>  		struct user_namespace *current_ns = current_user_ns();
>  
> -		ucred->uid = user_ns_map_uid(current_ns, cred, cred->euid);
> -		ucred->gid = user_ns_map_gid(current_ns, cred, cred->egid);
> +		ucred->uid = from_kuid(current_ns, cred->euid);
> +		ucred->gid = from_kgid(current_ns, cred->egid);
>  	}
>  }
>  EXPORT_SYMBOL_GPL(cred_to_ucred);
> -- 
> 1.7.2.5
> 
> _______________________________________________
> Containers mailing list
> Containers@...ts.linux-foundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/containers
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ