]> git.baikalelectronics.ru Git - kernel.git/commit
x86: ia32 syscall restart fix
authorRoland McGrath <roland@redhat.com>
Fri, 29 Feb 2008 03:57:07 +0000 (19:57 -0800)
committerIngo Molnar <mingo@elte.hu>
Tue, 11 Mar 2008 16:11:54 +0000 (17:11 +0100)
commit6e0b6a679075c800ea7fcc9f6592876a9a05f0c5
tree29a55b7ae8ca7488a9d84fb9de234cff9f8f80b4
parent6bbde6380a8379d67456bd123fcdc3373601beb3
x86: ia32 syscall restart fix

The code to restart syscalls after signals depends on checking for a
negative orig_ax, and for particular negative -ERESTART* values in ax.
These fields are 64 bits and for a 32-bit task they get zero-extended.
The syscall restart behavior is lost, a regression from a native 32-bit
kernel and from 64-bit tasks' behavior.

This patch fixes the problem by doing sign-extension where it matters.

For orig_ax, the only time the value should be -1 but winds up as
0x0ffffffff is via a 32-bit ptrace call. So the patch changes ptrace to
sign-extend the 32-bit orig_eax value when it's stored; it doesn't
change the checks on orig_ax, though it uses the new current_syscall()
inline to better document the subtle importance of the used of
signedness there.

The ax value is stored a lot of ways and it seems hard to get them all
sign-extended at their origins. So for that, we use the
current_syscall_ret() to sign-extend it only for 32-bit tasks at the
time of the -ERESTART* comparisons.

Signed-off-by: Roland McGrath <roland@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/kernel/ptrace.c
arch/x86/kernel/signal_64.c