* [PATCH 2/5] mn10300: prevent double syscall restarts
@ 2010-09-26 18:28 Al Viro
0 siblings, 0 replies; 2+ messages in thread
From: Al Viro @ 2010-09-26 18:28 UTC (permalink / raw)
To: linux-kernel; +Cc: dhowells, torvalds
set ->orig_d0 to -1, same as what sigreturn does
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
arch/mn10300/kernel/signal.c | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/arch/mn10300/kernel/signal.c b/arch/mn10300/kernel/signal.c
index 57178a8..4ef9925 100644
--- a/arch/mn10300/kernel/signal.c
+++ b/arch/mn10300/kernel/signal.c
@@ -432,6 +432,12 @@ give_sigsegv:
return -EFAULT;
}
+static inline void stepback(struct pt_regs *regs)
+{
+ regs->pc -= 2;
+ regs->orig_d0 = -1;
+}
+
/*
* handle the actual delivery of a signal to userspace
*/
@@ -459,7 +465,7 @@ static int handle_signal(int sig,
/* fallthrough */
case -ERESTARTNOINTR:
regs->d0 = regs->orig_d0;
- regs->pc -= 2;
+ stepback(regs);
}
}
@@ -527,12 +533,12 @@ static void do_signal(struct pt_regs *regs)
case -ERESTARTSYS:
case -ERESTARTNOINTR:
regs->d0 = regs->orig_d0;
- regs->pc -= 2;
+ stepback(regs);
break;
case -ERESTART_RESTARTBLOCK:
regs->d0 = __NR_restart_syscall;
- regs->pc -= 2;
+ stepback(regs);
break;
}
}
--
1.5.6.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH 2/5] mn10300: Prevent double syscall restarts
2010-09-27 10:47 [PATCH 1/5] mn10300: Avoid SIGSEGV delivery loop David Howells
@ 2010-09-27 10:47 ` David Howells
0 siblings, 0 replies; 2+ messages in thread
From: David Howells @ 2010-09-27 10:47 UTC (permalink / raw)
To: torvalds, akpm; +Cc: linux-am33-list, linux-kernel, Al Viro, David Howells
From: Al Viro <viro@ftp.linux.org.uk>
We need to make sure that only the first do_signal() to be handled on
the way out of the syscall handler will bother with syscall restarts.
We do this by setting orig_d0 to -1 as sigreturn does.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: David Howells <dhowells@redhat.com>
---
arch/mn10300/kernel/signal.c | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/arch/mn10300/kernel/signal.c b/arch/mn10300/kernel/signal.c
index 57178a8..4ef9925 100644
--- a/arch/mn10300/kernel/signal.c
+++ b/arch/mn10300/kernel/signal.c
@@ -432,6 +432,12 @@ give_sigsegv:
return -EFAULT;
}
+static inline void stepback(struct pt_regs *regs)
+{
+ regs->pc -= 2;
+ regs->orig_d0 = -1;
+}
+
/*
* handle the actual delivery of a signal to userspace
*/
@@ -459,7 +465,7 @@ static int handle_signal(int sig,
/* fallthrough */
case -ERESTARTNOINTR:
regs->d0 = regs->orig_d0;
- regs->pc -= 2;
+ stepback(regs);
}
}
@@ -527,12 +533,12 @@ static void do_signal(struct pt_regs *regs)
case -ERESTARTSYS:
case -ERESTARTNOINTR:
regs->d0 = regs->orig_d0;
- regs->pc -= 2;
+ stepback(regs);
break;
case -ERESTART_RESTARTBLOCK:
regs->d0 = __NR_restart_syscall;
- regs->pc -= 2;
+ stepback(regs);
break;
}
}
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-09-27 10:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-26 18:28 [PATCH 2/5] mn10300: prevent double syscall restarts Al Viro
2010-09-27 10:47 [PATCH 1/5] mn10300: Avoid SIGSEGV delivery loop David Howells
2010-09-27 10:47 ` [PATCH 2/5] mn10300: Prevent double syscall restarts David Howells
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).