]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
x86: ia32 ptrace vs -ENOSYS sysenter/syscall
authorRoland McGrath <roland@redhat.com>
Wed, 19 Mar 2008 01:23:50 +0000 (18:23 -0700)
committerIngo Molnar <mingo@elte.hu>
Thu, 17 Apr 2008 15:41:13 +0000 (17:41 +0200)
The previous "x86_64 ia32 ptrace vs -ENOSYS" fix only covered
the int $0x80 system call entries.  This does the same fix
for the sysenter and syscall instruction paths.

Signed-off-by: Roland McGrath <roland@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/ia32/ia32entry.S

index 30f492934f2309852f2cd6bd209de84994b4bc53..ae7158bce4d62d6b0ec1bfec5c52ead3b3e48049 100644 (file)
@@ -162,12 +162,14 @@ sysenter_tracesys:
        SAVE_REST
        CLEAR_RREGS
        movq    %r9,R9(%rsp)
-       movq    $-ENOSYS,RAX(%rsp)      /* really needed? */
+       movq    $-ENOSYS,RAX(%rsp)/* ptrace can change this for a bad syscall */
        movq    %rsp,%rdi        /* &pt_regs -> arg1 */
        call    syscall_trace_enter
        LOAD_ARGS32 ARGOFFSET  /* reload args from stack in case ptrace changed it */
        RESTORE_REST
        xchgl   %ebp,%r9d
+       cmpl    $(IA32_NR_syscalls-1),%eax
+       ja      int_ret_from_sys_call /* sysenter_tracesys has set RAX(%rsp) */
        jmp     sysenter_do_call
        CFI_ENDPROC
 ENDPROC(ia32_sysenter_target)
@@ -261,13 +263,15 @@ cstar_tracesys:
        SAVE_REST
        CLEAR_RREGS
        movq %r9,R9(%rsp)
-       movq $-ENOSYS,RAX(%rsp) /* really needed? */
+       movq $-ENOSYS,RAX(%rsp) /* ptrace can change this for a bad syscall */
        movq %rsp,%rdi        /* &pt_regs -> arg1 */
        call syscall_trace_enter
        LOAD_ARGS32 ARGOFFSET  /* reload args from stack in case ptrace changed it */
        RESTORE_REST
        xchgl %ebp,%r9d
        movl RSP-ARGOFFSET(%rsp), %r8d
+       cmpl $(IA32_NR_syscalls-1),%eax
+       ja int_ret_from_sys_call /* cstar_tracesys has set RAX(%rsp) */
        jmp cstar_do_call
 END(ia32_cstar_target)