Re: [PATCH] PPC32: cancel syscall restart on signal delivery

From: Linus Torvalds
Date: Sat Nov 15 2003 - 00:15:59 EST



On Sat, 15 Nov 2003, Paul Mackerras wrote:
>
> Now, when we resume that context we will call sys_restart_syscall
> which will call restart_block.fn. Which won't necessarily still point
> to do_no_restart_syscall. So I still think we have a problem.

Excellent point. We're actually much better off resetting it at signal
return.

Which should make all other resets unnecessary.

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?

Linus

----
===== arch/i386/kernel/signal.c 1.33 vs edited =====
--- 1.33/arch/i386/kernel/signal.c Tue Nov 11 21:18:46 2003
+++ edited/arch/i386/kernel/signal.c Fri Nov 14 21:13:09 2003
@@ -132,6 +132,9 @@
{
unsigned int err = 0;

+ /* Always make any pending restarted system calls return -EINTR */
+ current_thread_info()->restart_block.fn = do_no_restart_syscall;
+
#define COPY(x) err |= __get_user(regs->x, &sc->x)

#define COPY_SEG(seg) \
@@ -503,9 +506,6 @@
struct pt_regs * regs)
{
struct k_sigaction *ka = &current->sighand->action[sig-1];
-
- /* Always make any pending restarted system calls return -EINTR */
- current_thread_info()->restart_block.fn = do_no_restart_syscall;

/* Are we from a system call? */
if (regs->orig_eax >= 0) {

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/