mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paul Mackerras <paulus@samba.org>
To: Linus Torvalds <torvalds@osdl.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] PPC32: cancel syscall restart on signal delivery
Date: Sat, 15 Nov 2003 17:26:07 +1100	[thread overview]
Message-ID: <16309.50943.8136.360034@cargo.ozlabs.ibm.com> (raw)
In-Reply-To: <Pine.LNX.4.44.0311142108060.9014-100000@home.osdl.org>

Linus Torvalds writes:

> Excellent point. We're actually much better off resetting it at signal
> return.
> 
> Which should make all other resets unnecessary.

Yes.

> Yes, you can get out of a signal by using longjmp, but that doesn't
> matter: you can't longjump to a restart call (well, you can, but only if
> the user literally tries to do the restart by hand, ie he _intended_ to do
> it).
> 
> So the _proper_ fix (for x86) should be as appended. Agreed?

Agreed.  Here is the patch for PPC.

Thanks,
Paul.

diff -urN linux-2.5/arch/ppc/kernel/signal.c pmac-2.5/arch/ppc/kernel/signal.c
--- linux-2.5/arch/ppc/kernel/signal.c	2003-11-15 16:55:18.618797320 +1100
+++ pmac-2.5/arch/ppc/kernel/signal.c	2003-11-15 17:09:53.145849000 +1100
@@ -418,6 +418,9 @@
 {
 	struct rt_sigframe __user *rt_sf;
 
+	/* Always make any pending restarted system calls return -EINTR */
+	current_thread_info()->restart_block.fn = do_no_restart_syscall;
+
 	rt_sf = (struct rt_sigframe __user *)
 		(regs->gpr[1] + __SIGNAL_FRAMESIZE + 16);
 	if (verify_area(VERIFY_READ, rt_sf, sizeof(struct rt_sigframe)))
@@ -513,6 +516,9 @@
 	struct mcontext __user *sr;
 	sigset_t set;
 
+	/* Always make any pending restarted system calls return -EINTR */
+	current_thread_info()->restart_block.fn = do_no_restart_syscall;
+
 	sc = (struct sigcontext __user *)(regs->gpr[1] + __SIGNAL_FRAMESIZE);
 	if (copy_from_user(&sigctx, sc, sizeof(sigctx)))
 		goto badframe;
@@ -583,9 +589,6 @@
 	if (signr == 0)
 		return 0;		/* no signals delivered */
 
-	/* Always make any pending restarted system calls return -EINTR */
-	current_thread_info()->restart_block.fn = do_no_restart_syscall;
-
 	if ((ka->sa.sa_flags & SA_ONSTACK) && current->sas_ss_size
 	    && !on_sig_stack(regs->gpr[1]))
 		newsp = current->sas_ss_sp + current->sas_ss_size;

      parent reply	other threads:[~2003-11-15  6:23 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-15  0:04 Paul Mackerras
2003-11-15  0:21 ` Linus Torvalds
2003-11-15  0:31   ` Linus Torvalds
2003-11-15  2:59   ` Paul Mackerras
2003-11-15  3:11     ` Linus Torvalds
2003-11-15  3:25       ` Linus Torvalds
2003-11-15  5:03       ` Paul Mackerras
2003-11-15  5:14         ` Linus Torvalds
2003-11-15  5:47           ` Linus Torvalds
2003-11-15  6:26           ` Paul Mackerras [this message]

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=16309.50943.8136.360034@cargo.ozlabs.ibm.com \
    --to=paulus@samba.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.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

all inboxes | Powered by JetHome®