mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paul Mackerras <paulus@samba.org>
To: torvalds@osdl.org
Cc: anton@samba.org, linux-kernel@vger.kernel.org
Subject: [PATCH] PPC64: Fix possible race in syscall restart
Date: Tue, 18 Nov 2003 21:53:10 +1100	[thread overview]
Message-ID: <16313.64022.203052.444584@cargo.ozlabs.ibm.com> (raw)

Linus, please apply.

This is the PPC64 counterpart of the fix for the potential race in the
syscall restart code that has gone into other architectures.  It resets
current_thread_info()->restart_block.fn to do_no_syscall_restart in
the sigreturn code.

Thanks,
Paul.

diff -urN ppc64-linux-2.5/arch/ppc64/kernel/signal.c ppc64-2.5/arch/ppc64/kernel/signal.c
--- ppc64-linux-2.5/arch/ppc64/kernel/signal.c	2003-10-22 21:59:05.000000000 +1000
+++ ppc64-2.5/arch/ppc64/kernel/signal.c	2003-11-17 08:52:15.000000000 +1100
@@ -220,6 +220,9 @@
 	sigset_t set;
 	stack_t st;
 
+	/* Always make any pending restarted system calls return -EINTR */
+	current_thread_info()->restart_block.fn = do_no_restart_syscall;
+
 	if (verify_area(VERIFY_READ, uc, sizeof(*uc)))
 		goto badframe;
 
@@ -354,8 +357,6 @@
 {
 	switch ((int)regs->result) {
 	case -ERESTART_RESTARTBLOCK:
-		current_thread_info()->restart_block.fn = do_no_restart_syscall;
-		/* fallthrough */
 	case -ERESTARTNOHAND:
 		/* ERESTARTNOHAND means that the syscall should only be
 		 * restarted if there was no handler for the signal, and since
diff -urN ppc64-linux-2.5/arch/ppc64/kernel/signal32.c ppc64-2.5/arch/ppc64/kernel/signal32.c
--- ppc64-linux-2.5/arch/ppc64/kernel/signal32.c	2003-10-22 21:59:05.000000000 +1000
+++ ppc64-2.5/arch/ppc64/kernel/signal32.c	2003-11-17 08:54:29.000000000 +1100
@@ -300,6 +300,9 @@
 	struct sigcontext32 *sc = (struct sigcontext32 *)(u64)newsp;
 	int i;
 
+	/* Always make any pending restarted system calls return -EINTR */
+	current_thread_info()->restart_block.fn = do_no_restart_syscall;
+
 	if (verify_area(VERIFY_WRITE, frame, sizeof(*frame)))
 		goto badframe;
 	if (regs->msr & MSR_FP)
@@ -420,6 +423,9 @@
 	int i;
 	mm_segment_t old_fs;
 
+	/* Always make any pending restarted system calls return -EINTR */
+	current_thread_info()->restart_block.fn = do_no_restart_syscall;
+
 	/* Adjust the inputted reg1 to point to the first rt signal frame */
 	rt_sf = (struct rt_sigframe_32 *)(regs->gpr[1] + __SIGNAL_FRAMESIZE32);
 	/* Copy the information from the user stack  */

                 reply	other threads:[~2003-11-18 10:53 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=16313.64022.203052.444584@cargo.ozlabs.ibm.com \
    --to=paulus@samba.org \
    --cc=anton@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®