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:	Mon, 25 Jan 2016 20:09:15 +0100
From:	Oleg Nesterov <oleg@...hat.com>
To:	Sasha Levin <sasha.levin@...cle.com>
Cc:	akpm@...ux-foundation.org, linux-kernel@...r.kernel.org,
	mingo@...nel.org, peterz@...radead.org
Subject: Re: [PATCH] signals: work around random wakeups in sigsuspend()

On 01/25, Sasha Levin wrote:
>
> A random wakeup can get us out of sigsuspend() without TIF_SIGPENDING
> being set.

and TIF_RESTORE_SIGMASK is just wrong in this case. I'd say this is the
bugfix, not work-around ;)

> Avoid that by making sure we were signaled, like sys_pause() does.
>
> Signed-off-by: Sasha Levin <sasha.levin@...cle.com>

Acked-by: Oleg Nesterov <oleg@...hat.com>

Thanks Sasha.


> ---
>  kernel/signal.c |    6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/signal.c b/kernel/signal.c
> index 5da9180..3256c7e 100644
> --- a/kernel/signal.c
> +++ b/kernel/signal.c
> @@ -3528,8 +3528,10 @@ static int sigsuspend(sigset_t *set)
>  	current->saved_sigmask = current->blocked;
>  	set_current_blocked(set);
>  
> -	__set_current_state(TASK_INTERRUPTIBLE);
> -	schedule();
> +	while (!signal_pending(current)) {
> +		__set_current_state(TASK_INTERRUPTIBLE);
> +		schedule();
> +	}
>  	set_restore_sigmask();
>  	return -ERESTARTNOHAND;
>  }
> -- 
> 1.7.10.4
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ