sparc: Fix fork/clone/vfork system call restart.

Previous thread: sparc64: Fix initrd regression. by Linux Kernel Mailing List on Wednesday, May 7, 2008 - 8:59 pm. (1 message)

Next thread: [MAINTAINERS] New maintainer for Intel ethernet adapters by Linux Kernel Mailing List on Wednesday, May 7, 2008 - 8:59 pm. (1 message)
To: <git-commits-head@...>
Date: Wednesday, May 7, 2008 - 8:59 pm

Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=c...
Commit: 1e38c126c9252b612697e34f43b1b3371c8ee31d
Parent: 5816339310b2d9623cf413d33e538b45e815da5d
Author: David S. Miller <davem@davemloft.net>
AuthorDate: Wed May 7 16:21:28 2008 -0700
Committer: David S. Miller <davem@davemloft.net>
CommitDate: Wed May 7 16:21:28 2008 -0700

sparc: Fix fork/clone/vfork system call restart.

We clobber %i1 as well as %i0 for these system calls,
because they give two return values.

Therefore, on error, we have to restore %i1 properly
or else the restart explodes since it uses the wrong
arguments.

This fixes glibc's nptl/tst-eintr1.c testcase.

Signed-off-by: David S. Miller <davem@davemloft.net>
---
arch/sparc/kernel/process.c | 20 ++++++++++++++++----
arch/sparc64/kernel/process.c | 18 +++++++++++++++---
2 files changed, 31 insertions(+), 7 deletions(-)

diff --git a/arch/sparc/kernel/process.c b/arch/sparc/kernel/process.c
index e7f3519..36431f3 100644
--- a/arch/sparc/kernel/process.c
+++ b/arch/sparc/kernel/process.c
@@ -419,14 +419,26 @@ asmlinkage int sparc_do_fork(unsigned long clone_flags,
unsigned long stack_size)
{
unsigned long parent_tid_ptr, child_tid_ptr;
+ unsigned long orig_i1 = regs->u_regs[UREG_I1];
+ long ret;

parent_tid_ptr = regs->u_regs[UREG_I2];
child_tid_ptr = regs->u_regs[UREG_I4];

- return do_fork(clone_flags, stack_start,
- regs, stack_size,
- (int __user *) parent_tid_ptr,
- (int __user *) child_tid_ptr);
+ ret = do_fork(clone_flags, stack_start,
+ regs, stack_size,
+ (int __user *) parent_tid_ptr,
+ (int __user *) child_tid_ptr);
+
+ /* If we get an error and potentially restart the system
+ * call, we're screwed because copy_thread() clobbered
+ * the parent's %o1. So detect that case a...

Previous thread: sparc64: Fix initrd regression. by Linux Kernel Mailing List on Wednesday, May 7, 2008 - 8:59 pm. (1 message)

Next thread: [MAINTAINERS] New maintainer for Intel ethernet adapters by Linux Kernel Mailing List on Wednesday, May 7, 2008 - 8:59 pm. (1 message)