public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Matt Fleming <matt@console-pimps.org>
Cc: Haavard Skinnemoen <hskinnemoen@gmail.com>,
	Hans-Christian Egtvedt <egtvedt@samfundet.no>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: avr32: handle_signal() bug?
Date: Wed, 3 Aug 2011 15:08:13 +0200	[thread overview]
Message-ID: <20110803130813.GA11708@redhat.com> (raw)
In-Reply-To: <1312362279.10579.38.camel@mfleming-mobl1.ger.corp.intel.com>

On 08/03, Matt Fleming wrote:
>
> 	 * Block the signal if we were unsuccessful.
> 	 */
> 	if (ret != 0 || !(ka->sa.sa_flags & SA_NODEFER)) {
> 		spin_lock_irq(&current->sighand->siglock);
> 		sigorsets(&current->blocked, &current->blocked,
> 			  &ka->sa.sa_mask);
> 		sigaddset(&current->blocked, sig);
> 		recalc_sigpending();
> 		spin_unlock_irq(&current->sighand->siglock);
> 	}

Agreed, this looks "obviously wrong". We should block the !SA_NODEFER
signal it was delivered.

> Is there some intricacy of the avr32 architecture that I'm missing here?

same question here ;)

> --- a/arch/avr32/kernel/signal.c
> +++ b/arch/avr32/kernel/signal.c
> @@ -238,22 +238,21 @@ handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info,
>  	 */
>  	ret |= !valid_user_regs(regs);
>  
> +	if (ret != 0) {
> +		force_sigsegv(sig, current);
> +		return;
> +	}
> +
>  	/*
> -	 * Block the signal if we were unsuccessful.
> +	 * Block the signal if we were successful.
>  	 */
> -	if (ret != 0 || !(ka->sa.sa_flags & SA_NODEFER)) {
> -		spin_lock_irq(&current->sighand->siglock);
> -		sigorsets(&current->blocked, &current->blocked,
> -			  &ka->sa.sa_mask);
> +	spin_lock_irq(&current->sighand->siglock);
> +	sigorsets(&current->blocked, &current->blocked,
> +		  &ka->sa.sa_mask);
> +	if (!(ka->sa.sa_flags & SA_NODEFER))
>  		sigaddset(&current->blocked, sig);
> -		recalc_sigpending();
> -		spin_unlock_irq(&current->sighand->siglock);
> -	}
> -
> -	if (ret == 0)
> -		return;
> -
> -	force_sigsegv(sig, current);
> +	recalc_sigpending();
> +	spin_unlock_irq(&current->sighand->siglock);
>  }

I think this is correct.

Oleg.


  reply	other threads:[~2011-08-03 13:11 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-03  9:04 avr32: handle_signal() bug? Matt Fleming
2011-08-03 13:08 ` Oleg Nesterov [this message]
2011-08-03 13:39   ` [PATCH] avr32: use set_current_blocked() in handle_signal/sys_rt_sigreturn Oleg Nesterov
2011-08-03 13:56     ` Matt Fleming
2011-08-07 17:20 ` avr32: handle_signal() bug? Håvard Skinnemoen
2011-08-08 10:25   ` Matt Fleming
2011-08-16  5:55     ` Håvard Skinnemoen
2011-08-16  9:57       ` Matt Fleming
2011-08-16 15:39         ` Oleg Nesterov
2011-08-17  5:14           ` Håvard Skinnemoen
2011-08-17  9:48             ` Matt Fleming
2011-08-17  4:32         ` Håvard Skinnemoen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110803130813.GA11708@redhat.com \
    --to=oleg@redhat.com \
    --cc=egtvedt@samfundet.no \
    --cc=hskinnemoen@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matt@console-pimps.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox