diff options
author | Roland McGrath <roland@redhat.com> | 2008-03-17 00:59:11 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-04-17 11:41:13 -0400 |
commit | a31f8dd7ee3b2f5645c220406b1e21f82971f32b (patch) | |
tree | bb8904f23fbb9db5d34558cbe3b61bc3511ea249 /arch/x86/kernel/entry_64.S | |
parent | 8ab32bb89b5b9bf06147c31947eba65f0f21c3c0 (diff) |
x86: ptrace vs -ENOSYS
When we're stopped at syscall entry tracing, ptrace can change the %rax
value from -ENOSYS to something else. If no system call is actually made
because the syscall number (now in orig_rax) is bad, then we now always
reset %rax to -ENOSYS again.
This changes it to leave the return value alone after entry tracing.
That way, the %rax value set by ptrace is there to be seen in user mode
(or in syscall exit tracing). This is consistent with what the 32-bit
kernel does.
Signed-off-by: Roland McGrath <roland@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/entry_64.S')
-rw-r--r-- | arch/x86/kernel/entry_64.S | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S index c20c9e7e08dd..556a8df522a7 100644 --- a/arch/x86/kernel/entry_64.S +++ b/arch/x86/kernel/entry_64.S | |||
@@ -319,19 +319,17 @@ badsys: | |||
319 | /* Do syscall tracing */ | 319 | /* Do syscall tracing */ |
320 | tracesys: | 320 | tracesys: |
321 | SAVE_REST | 321 | SAVE_REST |
322 | movq $-ENOSYS,RAX(%rsp) | 322 | movq $-ENOSYS,RAX(%rsp) /* ptrace can change this for a bad syscall */ |
323 | FIXUP_TOP_OF_STACK %rdi | 323 | FIXUP_TOP_OF_STACK %rdi |
324 | movq %rsp,%rdi | 324 | movq %rsp,%rdi |
325 | call syscall_trace_enter | 325 | call syscall_trace_enter |
326 | LOAD_ARGS ARGOFFSET /* reload args from stack in case ptrace changed it */ | 326 | LOAD_ARGS ARGOFFSET /* reload args from stack in case ptrace changed it */ |
327 | RESTORE_REST | 327 | RESTORE_REST |
328 | cmpq $__NR_syscall_max,%rax | 328 | cmpq $__NR_syscall_max,%rax |
329 | movq $-ENOSYS,%rcx | 329 | ja int_ret_from_sys_call /* RAX(%rsp) set to -ENOSYS above */ |
330 | cmova %rcx,%rax | ||
331 | ja 1f | ||
332 | movq %r10,%rcx /* fixup for C */ | 330 | movq %r10,%rcx /* fixup for C */ |
333 | call *sys_call_table(,%rax,8) | 331 | call *sys_call_table(,%rax,8) |
334 | 1: movq %rax,RAX-ARGOFFSET(%rsp) | 332 | movq %rax,RAX-ARGOFFSET(%rsp) |
335 | /* Use IRET because user could have changed frame */ | 333 | /* Use IRET because user could have changed frame */ |
336 | 334 | ||
337 | /* | 335 | /* |