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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120418190711.GJ5186@mail.hallyn.com>
Date:	Wed, 18 Apr 2012 19:07:11 +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 32/43] userns: signal remove unnecessary map_cred_ns

Quoting Eric W. Beiderman (ebiederm@...ssion.com):
> From: Eric W. Biederman <ebiederm@...ssion.com>
> 
> map_cred_ns is a light wrapper around from_kuid with the order of the arguments
> reversed.  Replace map_cred_ns with from_kuid and remove map_cred_ns.
> 
> Signed-off-by: Eric W. Biederman <ebiederm@...ssion.com>

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

> ---
>  kernel/signal.c |   20 +++++---------------
>  1 files changed, 5 insertions(+), 15 deletions(-)
> 
> diff --git a/kernel/signal.c b/kernel/signal.c
> index 9797939..6aca310 100644
> --- a/kernel/signal.c
> +++ b/kernel/signal.c
> @@ -1019,15 +1019,6 @@ static inline int legacy_queue(struct sigpending *signals, int sig)
>  	return (sig < SIGRTMIN) && sigismember(&signals->signal, sig);
>  }
>  
> -/*
> - * map the uid in struct cred into user namespace *ns
> - */
> -static inline uid_t map_cred_ns(const struct cred *cred,
> -				struct user_namespace *ns)
> -{
> -	return from_kuid_munged(ns, cred->uid);
> -}
> -
>  #ifdef CONFIG_USER_NS
>  static inline void userns_fixup_signal_uid(struct siginfo *info, struct task_struct *t)
>  {
> @@ -1677,8 +1668,8 @@ bool do_notify_parent(struct task_struct *tsk, int sig)
>  	 */
>  	rcu_read_lock();
>  	info.si_pid = task_pid_nr_ns(tsk, tsk->parent->nsproxy->pid_ns);
> -	info.si_uid = map_cred_ns(__task_cred(tsk),
> -			task_cred_xxx(tsk->parent, user_ns));
> +	info.si_uid = from_kuid_munged(task_cred_xxx(tsk->parent, user_ns),
> +				       task_uid(tsk));
>  	rcu_read_unlock();
>  
>  	info.si_utime = cputime_to_clock_t(tsk->utime + tsk->signal->utime);
> @@ -1761,8 +1752,7 @@ static void do_notify_parent_cldstop(struct task_struct *tsk,
>  	 */
>  	rcu_read_lock();
>  	info.si_pid = task_pid_nr_ns(tsk, parent->nsproxy->pid_ns);
> -	info.si_uid = map_cred_ns(__task_cred(tsk),
> -			task_cred_xxx(parent, user_ns));
> +	info.si_uid = from_kuid_munged(task_cred_xxx(parent, user_ns), task_uid(tsk));
>  	rcu_read_unlock();
>  
>  	info.si_utime = cputime_to_clock_t(tsk->utime);
> @@ -2180,8 +2170,8 @@ static int ptrace_signal(int signr, siginfo_t *info,
>  		info->si_code = SI_USER;
>  		rcu_read_lock();
>  		info->si_pid = task_pid_vnr(current->parent);
> -		info->si_uid = map_cred_ns(__task_cred(current->parent),
> -				current_user_ns());
> +		info->si_uid = from_kuid_munged(current_user_ns(),
> +						task_uid(current->parent));
>  		rcu_read_unlock();
>  	}
>  
> -- 
> 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