diff options
author | Bodo Stroesser <bstroesser@fujitsu-siemens.com> | 2005-09-03 18:57:50 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@evo.osdl.org> | 2005-09-05 03:06:24 -0400 |
commit | 07bf731e4b95d7c9ea9dbacd1fc4a041120dfffb (patch) | |
tree | 25ae7f2000421d45e484abac0b7252809476c0d0 /arch/um/sys-x86_64/stub.S | |
parent | 8b51304ed3184826fb262c1e9d3e58b0b00fd083 (diff) |
[PATCH] uml: skas0 stubs now check system call return values
Change syscall-stub's data to include a "expected retval".
Stub now checks syscalls retval and aborts execution of syscall list, if
retval != expected retval.
run_syscall_stub prints the data of the failed syscall, using the data pointer
and retval written by the stub to the beginning of the stack.
one_syscall_stub is removed, to simplify code, because only some instructions
are saved by one_syscall_stub, no host-syscall.
Using the stub with additional data (modify_ldt via stub)
is prepared also.
Signed-off-by: Bodo Stroesser <bstroesser@fujitsu-siemens.com>
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/um/sys-x86_64/stub.S')
-rw-r--r-- | arch/um/sys-x86_64/stub.S | 50 |
1 files changed, 40 insertions, 10 deletions
diff --git a/arch/um/sys-x86_64/stub.S b/arch/um/sys-x86_64/stub.S index 957f2eff32ca..03c279735784 100644 --- a/arch/um/sys-x86_64/stub.S +++ b/arch/um/sys-x86_64/stub.S | |||
@@ -16,21 +16,51 @@ syscall_stub: | |||
16 | 16 | ||
17 | .globl batch_syscall_stub | 17 | .globl batch_syscall_stub |
18 | batch_syscall_stub: | 18 | batch_syscall_stub: |
19 | movq $(UML_CONFIG_STUB_DATA >> 32), %rbx | 19 | mov $(UML_CONFIG_STUB_DATA >> 32), %rbx |
20 | salq $32, %rbx | 20 | sal $32, %rbx |
21 | movq $(UML_CONFIG_STUB_DATA & 0xffffffff), %rcx | 21 | mov $(UML_CONFIG_STUB_DATA & 0xffffffff), %rax |
22 | or %rcx, %rbx | 22 | or %rax, %rbx |
23 | movq %rbx, %rsp | 23 | /* load pointer to first operation */ |
24 | again: pop %rax | 24 | mov %rbx, %rsp |
25 | cmpq $0, %rax | 25 | add $0x10, %rsp |
26 | jz done | 26 | again: |
27 | /* load length of additional data */ | ||
28 | mov 0x0(%rsp), %rax | ||
29 | |||
30 | /* if(length == 0) : end of list */ | ||
31 | /* write possible 0 to header */ | ||
32 | mov %rax, 8(%rbx) | ||
33 | cmp $0, %rax | ||
34 | jz done | ||
35 | |||
36 | /* save current pointer */ | ||
37 | mov %rsp, 8(%rbx) | ||
38 | |||
39 | /* skip additional data */ | ||
40 | add %rax, %rsp | ||
41 | |||
42 | /* load syscall-# */ | ||
43 | pop %rax | ||
44 | |||
45 | /* load syscall params */ | ||
27 | pop %rdi | 46 | pop %rdi |
28 | pop %rsi | 47 | pop %rsi |
29 | pop %rdx | 48 | pop %rdx |
30 | pop %r10 | 49 | pop %r10 |
31 | pop %r8 | 50 | pop %r8 |
32 | pop %r9 | 51 | pop %r9 |
52 | |||
53 | /* execute syscall */ | ||
33 | syscall | 54 | syscall |
55 | |||
56 | /* check return value */ | ||
57 | pop %rcx | ||
58 | cmp %rcx, %rax | ||
59 | je again | ||
60 | |||
61 | done: | ||
62 | /* save return value */ | ||
34 | mov %rax, (%rbx) | 63 | mov %rax, (%rbx) |
35 | jmp again | 64 | |
36 | done: int3 | 65 | /* stop */ |
66 | int3 | ||