syscall: set -ENOSYS to syscall_return before calling ptrace_syscall_enter

refs #943
This commit is contained in:
Tomoki Shirasawa
2017-09-26 14:25:49 +09:00
parent a2fbe99b60
commit df3f388e09
3 changed files with 27 additions and 3 deletions

View File

@ -49,6 +49,7 @@ typedef struct x86_user_context ihk_mc_user_context_t;
#define ihk_mc_syscall_arg5(uc) (uc)->gpr.r9
#define ihk_mc_syscall_ret(uc) (uc)->gpr.rax
#define ihk_mc_syscall_number(uc) (uc)->gpr.orig_rax
#define ihk_mc_syscall_pc(uc) (uc)->gpr.rip
#define ihk_mc_syscall_sp(uc) (uc)->gpr.rsp

View File

@ -189,9 +189,30 @@ struct tss64 {
} __attribute__((packed));
struct x86_basic_regs {
unsigned long r15, r14, r13, r12, rbp, rbx, r11, r10;
unsigned long r9, r8, rax, rcx, rdx, rsi, rdi, error;
unsigned long rip, cs, rflags, rsp, ss;
unsigned long r15;
unsigned long r14;
unsigned long r13;
unsigned long r12;
unsigned long rbp;
unsigned long rbx;
unsigned long r11;
unsigned long r10;
unsigned long r9;
unsigned long r8;
unsigned long rax;
unsigned long rcx;
unsigned long rdx;
unsigned long rsi;
unsigned long rdi;
union {
unsigned long orig_rax; /* syscall */
unsigned long error; /* interrupts */
};
unsigned long rip;
unsigned long cs;
unsigned long rflags;
unsigned long rsp;
unsigned long ss;
};
struct x86_sregs {

View File

@ -9928,7 +9928,9 @@ long syscall(int num, ihk_mc_user_context_t *ctx)
cpu_enable_interrupt();
if (cpu_local_var(current)->proc->ptrace) {
ihk_mc_syscall_ret(ctx) = -ENOSYS;
ptrace_syscall_enter(cpu_local_var(current));
num = ihk_mc_syscall_number(ctx);
}
#if 0