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]
Date:	Wed, 24 Dec 2008 16:43:10 +0100
From:	Oleg Nesterov <oleg@...hat.com>
To:	Sukadev Bhattiprolu <sukadev@...ux.vnet.ibm.com>
Cc:	ebiederm@...ssion.com, roland@...hat.com, bastian@...di.eu.org,
	daniel@...ac.com, xemul@...nvz.org, containers@...ts.osdl.org,
	linux-kernel@...r.kernel.org
Subject: Re: [RFC][PATCH 6/7][v4] SI_USER: Masquerade si_pid when crossing
	pid ns boundary

On 12/24, Sukadev Bhattiprolu wrote:
>
> +static void masquerade_si_pid(struct task_struct *t, siginfo_t *info)
> +{
> +	if (is_si_special(info) || SI_FROMKERNEL(info))
> +		return;
> +
> +	/*
> +	 * When crossing pid namespace boundary, SI_USER signal can only
> +	 * go from ancestor to descendant ns but not the other way. So,
> +	 * just ->si_pid to 0 since, the sender will not have a pid in
> +	 * the receiver's namespace.
> +	 */
> +	if (info->si_code == SI_USER)
> +		info->si_pid = 0;
> +}
> +
>  static int send_signal(int sig, struct siginfo *info, struct task_struct *t,
>  			int group)
>  {
> @@ -946,6 +974,8 @@ static int send_signal(int sig, struct siginfo *info, struct task_struct *t,
>  			break;
>  		default:
>  			copy_siginfo(&q->info, info);
> +			if (from_ancestor_ns)
> +				masquerade_si_pid(t, &q->info);
>  			break;
>  		}
>  	} else if (!is_si_special(info)) {
> @@ -2343,7 +2373,7 @@ sys_kill(pid_t pid, int sig)
>  	info.si_signo = sig;
>  	info.si_errno = 0;
>  	info.si_code = SI_USER;
> -	info.si_pid = task_tgid_vnr(current);
> +	info.si_pid = 0;	/* masquerade in send_signal() */
>  	info.si_uid = current_uid();

Can't understand this patch. First of all, it looks wrong. Looks like
we never set .si_pid != 0 when the signal is set by sys_kill() ?

But more importantly, unless I missed something, this patch is unnecessary
complication.

We call masquerade_si_pid() only when from_ancestor_ns == T, this is correct.
But this means that (!is_si_special(info) && SI_FROMUSER(info)) == T, why
do we re-check in masquerade_si_pid() ?

And why can't we just do

	 default:
	 	copy_siginfo(&q->info, info);
	 	if (from_ancestor_ns)
	 		info->si_pid = 0;

? Why should we check SI_USER and change sys_kill() ?

see also the comment for the next 7/7 patch.

Oleg.

--
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