linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vineet Gupta <Vineet.Gupta1@synopsys.com>
To: Richard Weinberger <richard@nod.at>, linux-kernel@vger.kernel.org
Cc: linux-arch@vger.kernel.org, viro@zeniv.linux.org.uk,
	catalin.marinas@arm.com, will.deacon@arm.com,
	hskinnemoen@gmail.com, egtvedt@samfundet.no, vapier@gentoo.org,
	msalter@redhat.com, a-jacquiot@ti.com, starvik@axis.com,
	jesper.nilsson@axis.com, dhowells@redhat.com,
	rkuo@codeaurora.org, tony.luck@intel.com, fenghua.yu@intel.com,
	takata@linux-m32r.org, geert@linux-m68k.org,
	james.hogan@imgtec.com, monstr@monstr.eu,
	yasutake.koichi@jp.panasonic.com, ralf@linux-mips.org,
	jonas@southpole.se, jejb@parisc-linux.org, deller@gmx.de,
	benh@kernel.crashing.org, paulus@samba.org,
	schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com,
	liqin.linux@gmail.com, lennox.wu@gmail.com,
	linux-sh@vger.kernel.org, cmetcalf@tilera.com,
	gxt@mprc.pku.edu.cn, linux-xtensa@linux-xtensa.org,
	akpm@linux-foundation.org, oleg@redhat.co
Subject: Re: [PATCH 01/29] arc: Use get_signal() signal_setup_done()
Date: Tue, 8 Oct 2013 19:43:39 +0530	[thread overview]
Message-ID: <52541313.4020101@synopsys.com> (raw)
In-Reply-To: <1381231701-4008-2-git-send-email-richard@nod.at>

Hi Richard/all,

Sorry if this is repost - it seems the bounce back from Paul Mundt caused my
earlier reply to not be posted to list. I wonder how other are managing to reply
to thread or is that a Synopsys email server quirk.

Anyways,

On 10/08/2013 04:57 PM, Richard Weinberger wrote:
> Use the more generic functions get_signal() signal_setup_done()
> for signal delivery.

I never realized Al has added the infrastructure already (back when ARC port was
being discussed for mainlining)

Since you are touching all arches, it might make sense to also throw in sigsp()
replacement too.

Something like below:

-    if ((ka->sa.sa_flags & SA_ONSTACK) && !sas_ss_flags(sp))
-        sp = current->sas_ss_sp + current->sas_ss_size;


> 
> Signed-off-by: Richard Weinberger <richard@nod.at>
> ---
>  arch/arc/kernel/signal.c | 39 +++++++++++++++------------------------
>  1 file changed, 15 insertions(+), 24 deletions(-)
> 
> diff --git a/arch/arc/kernel/signal.c b/arch/arc/kernel/signal.c
> index 7e95e1a..c2031e2 100644
> --- a/arch/arc/kernel/signal.c
> +++ b/arch/arc/kernel/signal.c
> @@ -179,14 +179,13 @@ static inline int map_sig(int sig)
>  }
>  
>  static int
> -setup_rt_frame(int signo, struct k_sigaction *ka, siginfo_t *info,
> -	       sigset_t *set, struct pt_regs *regs)
> +setup_rt_frame(struct ksignal *ksig, sigset_t *set, struct pt_regs *regs)
>  {
>  	struct rt_sigframe __user *sf;
>  	unsigned int magic = 0;
>  	int err = 0;
>  
> -	sf = get_sigframe(ka, regs, sizeof(struct rt_sigframe));
> +	sf = get_sigframe(&ksig->ka, regs, sizeof(struct rt_sigframe));

At least for ARC, it is possible to change get_sigframe() first arg to be ksignal
as well. Rest of changes look good.

Thanks for the series !

P.S. I wonder how u r going to achieve closure on this since SH folks have not
been responding. A patch series of mine is stuck in mid air due to lack of ACK/NAK
from them.

-Vineet

>  	if (!sf)
>  		return 1;
>  
> @@ -205,8 +204,8 @@ setup_rt_frame(int signo, struct k_sigaction *ka, siginfo_t *info,
>  	 *  #2: struct siginfo
>  	 *  #3: struct ucontext (completely populated)
>  	 */
> -	if (unlikely(ka->sa.sa_flags & SA_SIGINFO)) {
> -		err |= copy_siginfo_to_user(&sf->info, info);
> +	if (unlikely(ksig->ka.sa.sa_flags & SA_SIGINFO)) {
> +		err |= copy_siginfo_to_user(&sf->info, &ksig->info);
>  		err |= __put_user(0, &sf->uc.uc_flags);
>  		err |= __put_user(NULL, &sf->uc.uc_link);
>  		err |= __save_altstack(&sf->uc.uc_stack, regs->sp);
> @@ -227,16 +226,16 @@ setup_rt_frame(int signo, struct k_sigaction *ka, siginfo_t *info,
>  		return err;
>  
>  	/* #1 arg to the user Signal handler */
> -	regs->r0 = map_sig(signo);
> +	regs->r0 = map_sig(ksig->sig);
>  
>  	/* setup PC of user space signal handler */
> -	regs->ret = (unsigned long)ka->sa.sa_handler;
> +	regs->ret = (unsigned long)ksig->ka.sa.sa_handler;
>  
>  	/*
>  	 * handler returns using sigreturn stub provided already by userpsace
>  	 */
> -	BUG_ON(!(ka->sa.sa_flags & SA_RESTORER));
> -	regs->blink = (unsigned long)ka->sa.sa_restorer;
> +	BUG_ON(!(ksig->ka.sa.sa_flags & SA_RESTORER));
> +	regs->blink = (unsigned long)ksig->ka.sa.sa_restorer;
>  
>  	/* User Stack for signal handler will be above the frame just carved */
>  	regs->sp = (unsigned long)sf;
> @@ -298,38 +297,30 @@ static void arc_restart_syscall(struct k_sigaction *ka, struct pt_regs *regs)
>   * OK, we're invoking a handler
>   */
>  static void
> -handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info,
> -	      struct pt_regs *regs)
> +handle_signal(struct ksignal *ksig, struct pt_regs *regs)
>  {
>  	sigset_t *oldset = sigmask_to_save();
>  	int ret;
>  
>  	/* Set up the stack frame */
> -	ret = setup_rt_frame(sig, ka, info, oldset, regs);
> +	ret = setup_rt_frame(ksig, oldset, regs);
>  
> -	if (ret)
> -		force_sigsegv(sig, current);
> -	else
> -		signal_delivered(sig, info, ka, regs, 0);
> +	signal_setup_done(ret, ksig, 0);
>  }
>  
>  void do_signal(struct pt_regs *regs)
>  {
> -	struct k_sigaction ka;
> -	siginfo_t info;
> -	int signr;
> +	struct ksignal ksig;
>  	int restart_scall;
>  
> -	signr = get_signal_to_deliver(&info, &ka, regs, NULL);
> -
>  	restart_scall = in_syscall(regs) && syscall_restartable(regs);
>  
> -	if (signr > 0) {
> +	if (get_signal(&ksig)) {
>  		if (restart_scall) {
> -			arc_restart_syscall(&ka, regs);
> +			arc_restart_syscall(&ksig.ka, regs);
>  			syscall_wont_restart(regs);	/* No more restarts */
>  		}
> -		handle_signal(signr, &ka, &info, regs);
> +		handle_signal(&ksig, regs);
>  		return;
>  	}
>  
> 


WARNING: multiple messages have this Message-ID (diff)
From: Vineet Gupta <Vineet.Gupta1@synopsys.com>
To: Richard Weinberger <richard@nod.at>, linux-kernel@vger.kernel.org
Cc: linux-arch@vger.kernel.org, viro@zeniv.linux.org.uk,
	catalin.marinas@arm.com, will.deacon@arm.com,
	hskinnemoen@gmail.com, egtvedt@samfundet.no, vapier@gentoo.org,
	msalter@redhat.com, a-jacquiot@ti.com, starvik@axis.com,
	jesper.nilsson@axis.com, dhowells@redhat.com,
	rkuo@codeaurora.org, tony.luck@intel.com, fenghua.yu@intel.com,
	takata@linux-m32r.org, geert@linux-m68k.org,
	james.hogan@imgtec.com, monstr@monstr.eu,
	yasutake.koichi@jp.panasonic.com, ralf@linux-mips.org,
	jonas@southpole.se, jejb@parisc-linux.org, deller@gmx.de,
	benh@kernel.crashing.org, paulus@samba.org,
	schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com,
	liqin.linux@gmail.com, lennox.wu@gmail.com,
	linux-sh@vger.kernel.org, cmetcalf@tilera.com,
	gxt@mprc.pku.edu.cn, linux-xtensa@linux-xtensa.org,
	akpm@linux-foundation.org, oleg@redhat.com, tj@kernel.org
Subject: Re: [PATCH 01/29] arc: Use get_signal() signal_setup_done()
Date: Tue, 8 Oct 2013 19:43:39 +0530	[thread overview]
Message-ID: <52541313.4020101@synopsys.com> (raw)
Message-ID: <20131008141339.vhkYhBXn2Wa9KnNwEQ-5UP3rHxOXhim3asSPSrIshiI@z> (raw)
In-Reply-To: <1381231701-4008-2-git-send-email-richard@nod.at>

Hi Richard/all,

Sorry if this is repost - it seems the bounce back from Paul Mundt caused my
earlier reply to not be posted to list. I wonder how other are managing to reply
to thread or is that a Synopsys email server quirk.

Anyways,

On 10/08/2013 04:57 PM, Richard Weinberger wrote:
> Use the more generic functions get_signal() signal_setup_done()
> for signal delivery.

I never realized Al has added the infrastructure already (back when ARC port was
being discussed for mainlining)

Since you are touching all arches, it might make sense to also throw in sigsp()
replacement too.

Something like below:

-    if ((ka->sa.sa_flags & SA_ONSTACK) && !sas_ss_flags(sp))
-        sp = current->sas_ss_sp + current->sas_ss_size;


> 
> Signed-off-by: Richard Weinberger <richard@nod.at>
> ---
>  arch/arc/kernel/signal.c | 39 +++++++++++++++------------------------
>  1 file changed, 15 insertions(+), 24 deletions(-)
> 
> diff --git a/arch/arc/kernel/signal.c b/arch/arc/kernel/signal.c
> index 7e95e1a..c2031e2 100644
> --- a/arch/arc/kernel/signal.c
> +++ b/arch/arc/kernel/signal.c
> @@ -179,14 +179,13 @@ static inline int map_sig(int sig)
>  }
>  
>  static int
> -setup_rt_frame(int signo, struct k_sigaction *ka, siginfo_t *info,
> -	       sigset_t *set, struct pt_regs *regs)
> +setup_rt_frame(struct ksignal *ksig, sigset_t *set, struct pt_regs *regs)
>  {
>  	struct rt_sigframe __user *sf;
>  	unsigned int magic = 0;
>  	int err = 0;
>  
> -	sf = get_sigframe(ka, regs, sizeof(struct rt_sigframe));
> +	sf = get_sigframe(&ksig->ka, regs, sizeof(struct rt_sigframe));

At least for ARC, it is possible to change get_sigframe() first arg to be ksignal
as well. Rest of changes look good.

Thanks for the series !

P.S. I wonder how u r going to achieve closure on this since SH folks have not
been responding. A patch series of mine is stuck in mid air due to lack of ACK/NAK
from them.

-Vineet

>  	if (!sf)
>  		return 1;
>  
> @@ -205,8 +204,8 @@ setup_rt_frame(int signo, struct k_sigaction *ka, siginfo_t *info,
>  	 *  #2: struct siginfo
>  	 *  #3: struct ucontext (completely populated)
>  	 */
> -	if (unlikely(ka->sa.sa_flags & SA_SIGINFO)) {
> -		err |= copy_siginfo_to_user(&sf->info, info);
> +	if (unlikely(ksig->ka.sa.sa_flags & SA_SIGINFO)) {
> +		err |= copy_siginfo_to_user(&sf->info, &ksig->info);
>  		err |= __put_user(0, &sf->uc.uc_flags);
>  		err |= __put_user(NULL, &sf->uc.uc_link);
>  		err |= __save_altstack(&sf->uc.uc_stack, regs->sp);
> @@ -227,16 +226,16 @@ setup_rt_frame(int signo, struct k_sigaction *ka, siginfo_t *info,
>  		return err;
>  
>  	/* #1 arg to the user Signal handler */
> -	regs->r0 = map_sig(signo);
> +	regs->r0 = map_sig(ksig->sig);
>  
>  	/* setup PC of user space signal handler */
> -	regs->ret = (unsigned long)ka->sa.sa_handler;
> +	regs->ret = (unsigned long)ksig->ka.sa.sa_handler;
>  
>  	/*
>  	 * handler returns using sigreturn stub provided already by userpsace
>  	 */
> -	BUG_ON(!(ka->sa.sa_flags & SA_RESTORER));
> -	regs->blink = (unsigned long)ka->sa.sa_restorer;
> +	BUG_ON(!(ksig->ka.sa.sa_flags & SA_RESTORER));
> +	regs->blink = (unsigned long)ksig->ka.sa.sa_restorer;
>  
>  	/* User Stack for signal handler will be above the frame just carved */
>  	regs->sp = (unsigned long)sf;
> @@ -298,38 +297,30 @@ static void arc_restart_syscall(struct k_sigaction *ka, struct pt_regs *regs)
>   * OK, we're invoking a handler
>   */
>  static void
> -handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info,
> -	      struct pt_regs *regs)
> +handle_signal(struct ksignal *ksig, struct pt_regs *regs)
>  {
>  	sigset_t *oldset = sigmask_to_save();
>  	int ret;
>  
>  	/* Set up the stack frame */
> -	ret = setup_rt_frame(sig, ka, info, oldset, regs);
> +	ret = setup_rt_frame(ksig, oldset, regs);
>  
> -	if (ret)
> -		force_sigsegv(sig, current);
> -	else
> -		signal_delivered(sig, info, ka, regs, 0);
> +	signal_setup_done(ret, ksig, 0);
>  }
>  
>  void do_signal(struct pt_regs *regs)
>  {
> -	struct k_sigaction ka;
> -	siginfo_t info;
> -	int signr;
> +	struct ksignal ksig;
>  	int restart_scall;
>  
> -	signr = get_signal_to_deliver(&info, &ka, regs, NULL);
> -
>  	restart_scall = in_syscall(regs) && syscall_restartable(regs);
>  
> -	if (signr > 0) {
> +	if (get_signal(&ksig)) {
>  		if (restart_scall) {
> -			arc_restart_syscall(&ka, regs);
> +			arc_restart_syscall(&ksig.ka, regs);
>  			syscall_wont_restart(regs);	/* No more restarts */
>  		}
> -		handle_signal(signr, &ka, &info, regs);
> +		handle_signal(&ksig, regs);
>  		return;
>  	}
>  
> 


  parent reply	other threads:[~2013-10-08 14:13 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-08 11:27 Global do_signal() cleanup Richard Weinberger
2013-10-08 11:27 ` [PATCH 01/29] arc: Use get_signal() signal_setup_done() Richard Weinberger
2013-10-08 11:27   ` Richard Weinberger
2013-10-08 14:13   ` Vineet Gupta [this message]
2013-10-08 14:13     ` Vineet Gupta
2013-10-08 15:59     ` Richard Weinberger
2013-10-08 15:59       ` Richard Weinberger
2013-10-08 11:27 ` [PATCH 02/29] arm64: " Richard Weinberger
2013-10-08 11:27   ` Richard Weinberger
2013-10-08 11:27 ` [PATCH 03/29] avr32: " Richard Weinberger
2013-10-08 11:27   ` Richard Weinberger
2013-10-08 11:27 ` [PATCH 04/29] blackfin: " Richard Weinberger
2013-10-08 11:27   ` Richard Weinberger
2013-10-08 11:27 ` [PATCH 05/29] c6x: " Richard Weinberger
2013-10-08 13:38 ` Global do_signal() cleanup Michal Simek
2013-10-08 15:53   ` Richard Weinberger

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=52541313.4020101@synopsys.com \
    --to=vineet.gupta1@synopsys.com \
    --cc=a-jacquiot@ti.com \
    --cc=akpm@linux-foundation.org \
    --cc=benh@kernel.crashing.org \
    --cc=catalin.marinas@arm.com \
    --cc=cmetcalf@tilera.com \
    --cc=deller@gmx.de \
    --cc=dhowells@redhat.com \
    --cc=egtvedt@samfundet.no \
    --cc=fenghua.yu@intel.com \
    --cc=geert@linux-m68k.org \
    --cc=gxt@mprc.pku.edu.cn \
    --cc=heiko.carstens@de.ibm.com \
    --cc=hskinnemoen@gmail.com \
    --cc=james.hogan@imgtec.com \
    --cc=jejb@parisc-linux.org \
    --cc=jesper.nilsson@axis.com \
    --cc=jonas@southpole.se \
    --cc=lennox.wu@gmail.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    --cc=linux-xtensa@linux-xtensa.org \
    --cc=liqin.linux@gmail.com \
    --cc=monstr@monstr.eu \
    --cc=msalter@redhat.com \
    --cc=oleg@redhat.co \
    --cc=paulus@samba.org \
    --cc=ralf@linux-mips.org \
    --cc=richard@nod.at \
    --cc=rkuo@codeaurora.org \
    --cc=schwidefsky@de.ibm.com \
    --cc=starvik@axis.com \
    --cc=takata@linux-m32r.org \
    --cc=tony.luck@intel.com \
    --cc=vapier@gentoo.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=will.deacon@arm.com \
    --cc=yasutake.koichi@jp.panasonic.com \
    /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;
as well as URLs for NNTP newsgroup(s).