public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* 32bit processes at compatbility mode on x86_64 machines fail to restart syscall after processing a signal
@ 2005-05-19  1:18 Zhang, Yanmin
  2005-05-19  1:49 ` Andi Kleen
  0 siblings, 1 reply; 2+ messages in thread
From: Zhang, Yanmin @ 2005-05-19  1:18 UTC (permalink / raw)
  To: discuss; +Cc: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 772 bytes --]

The test case at
http://cvs.sourceforge.net/viewcvs.py/posixtest/posixtestsuite/conforman
ce/interfaces/clock_nanosleep/1-5.c fails if it runs as a 32bit process
on x86_86 machines.

The root cause is the sub 32bit process fails to restart the syscall
after it is interrupted
by a signal.

The syscall number of sys_restart_syscall in table sys_call_table is 
__NR_restart_syscall (219) while it's __NR_ia32_restart_syscall (0) in
ia32_sys_call_table. When regs->rax==(unsigned
long)-ERESTART_RESTARTBLOCK,
function do_signal doesn't distinguish if the process is 64bit or 32bit,
and always sets
restart syscall number as __NR_restart_syscall (219).

Here is a patch against kernel 2.6.12-rc4.

Signed-off-by: Zhang Yanmin <yanmin.zhang@intel.com>



[-- Attachment #2: 32bit_process_fail_restart_syscall.patch --]
[-- Type: application/octet-stream, Size: 623 bytes --]

diff -Nraup linux-2.6.12-rc4/arch/x86_64/kernel/signal.c linux-2.6.12-rc4_fix/arch/x86_64/kernel/signal.c
--- linux-2.6.12-rc4/arch/x86_64/kernel/signal.c	2005-05-12 22:19:40.000000000 -0700
+++ linux-2.6.12-rc4_fix/arch/x86_64/kernel/signal.c	2005-05-18 09:57:00.000000000 -0700
@@ -452,7 +452,10 @@ int do_signal(struct pt_regs *regs, sigs
 			regs->rip -= 2;
 		}
 		if (regs->rax == (unsigned long)-ERESTART_RESTARTBLOCK) {
-			regs->rax = __NR_restart_syscall;
+			if (test_thread_flag(TIF_IA32))
+				regs->rax = __NR_ia32_restart_syscall;
+			else
+				regs->rax = __NR_restart_syscall;
 			regs->rip -= 2;
 		}
 	}

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: 32bit processes at compatbility mode on x86_64 machines fail to restart syscall after processing a signal
  2005-05-19  1:18 32bit processes at compatbility mode on x86_64 machines fail to restart syscall after processing a signal Zhang, Yanmin
@ 2005-05-19  1:49 ` Andi Kleen
  0 siblings, 0 replies; 2+ messages in thread
From: Andi Kleen @ 2005-05-19  1:49 UTC (permalink / raw)
  To: Zhang, Yanmin; +Cc: linux-kernel

"Zhang, Yanmin" <yanmin.zhang@intel.com> writes:

> The test case at
> http://cvs.sourceforge.net/viewcvs.py/posixtest/posixtestsuite/conforman
> ce/interfaces/clock_nanosleep/1-5.c fails if it runs as a 32bit process
> on x86_86 machines.
>
> The root cause is the sub 32bit process fails to restart the syscall
> after it is interrupted
> by a signal.
>
> The syscall number of sys_restart_syscall in table sys_call_table is 
> __NR_restart_syscall (219) while it's __NR_ia32_restart_syscall (0) in
> ia32_sys_call_table. When regs->rax==(unsigned
> long)-ERESTART_RESTARTBLOCK,
> function do_signal doesn't distinguish if the process is 64bit or 32bit,
> and always sets
> restart syscall number as __NR_restart_syscall (219).

Thanks for tracking this down. Queued.

-Andi


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-05-19  1:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-19  1:18 32bit processes at compatbility mode on x86_64 machines fail to restart syscall after processing a signal Zhang, Yanmin
2005-05-19  1:49 ` Andi Kleen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox