[CRIU] [PATCH 1/4] signal: allow to send any siginfo to itself

Pavel Emelyanov xemul at parallels.com
Tue Dec 4 06:03:19 EST 2012


On 12/04/2012 02:05 PM, Andrey Vagin wrote:
> A kernel prevents of sending sifinfo with positive si_code, because
> these codes is reserved for kernel. I think we can allow to send any
> siginfo to itself. This operation should not be dangerous.
> 
> This functionality is required for restoring signals.

How do I chose whether to send signal to self queue or to shared one?

> Signed-off-by: Andrey Vagin <avagin at openvz.org>
> ---
>  kernel/signal.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/signal.c b/kernel/signal.c
> index 0af8868..1daa015 100644
> --- a/kernel/signal.c
> +++ b/kernel/signal.c
> @@ -2952,7 +2952,8 @@ SYSCALL_DEFINE3(rt_sigqueueinfo, pid_t, pid, int, sig,
>  	/* Not even root can pretend to send signals from the kernel.
>  	 * Nor can they impersonate a kill()/tgkill(), which adds source info.
>  	 */
> -	if (info.si_code >= 0 || info.si_code == SI_TKILL) {
> +	if (((info.si_code >= 0 || info.si_code == SI_TKILL)) &&
> +	    (task_pid_vnr(current) != pid)) {
>  		/* We used to allow any < 0 si_code */
>  		WARN_ON_ONCE(info.si_code < 0);
>  		return -EPERM;
> @@ -2972,7 +2973,8 @@ long do_rt_tgsigqueueinfo(pid_t tgid, pid_t pid, int sig, siginfo_t *info)
>  	/* Not even root can pretend to send signals from the kernel.
>  	 * Nor can they impersonate a kill()/tgkill(), which adds source info.
>  	 */
> -	if (info->si_code >= 0 || info->si_code == SI_TKILL) {
> +	if ((info->si_code >= 0 || info->si_code == SI_TKILL) &&
> +	    (task_pid_vnr(current) != pid)) {
>  		/* We used to allow any < 0 si_code */
>  		WARN_ON_ONCE(info->si_code < 0);
>  		return -EPERM;
> 




More information about the CRIU mailing list