void syscall_handler_tt(int sig, struct pt_regs *regs) { void *sc; long result; int syscall; #ifdef CONFIG_SYSCALL_DEBUG int index; index = record_syscall_start(syscall); #endif sc = UPT_SC(®s->regs); SC_START_SYSCALL(sc); syscall_trace(®s->regs, 0); current->thread.nsyscalls++; nsyscalls++; syscall = UPT_SYSCALL_NR(®s->regs); if((syscall >= NR_syscalls) || (syscall < 0)) result = -ENOSYS; else result = EXECUTE_SYSCALL(syscall, regs); /* regs->sc may have changed while the system call ran (there may * have been an interrupt or segfault), so it needs to be refreshed. */ UPT_SC(®s->regs) = sc; SC_SET_SYSCALL_RETURN(sc, result); syscall_trace(®s->regs, 1); #ifdef CONFIG_SYSCALL_DEBUG record_syscall_end(index, result); #endif }
void handle_syscall(struct uml_pt_regs *r) { struct pt_regs *regs = container_of(r, struct pt_regs, regs); long result; int syscall; syscall_trace_enter(regs); /* * This should go in the declaration of syscall, but when I do that, * strace -f -c bash -c 'ls ; ls' breaks, sometimes not tracing * children at all, sometimes hanging when bash doesn't see the first * ls exit. * The assembly looks functionally the same to me. This is * gcc version 4.0.1 20050727 (Red Hat 4.0.1-5) * in case it's a compiler bug. */ syscall = UPT_SYSCALL_NR(r); //it's just (r)->syscall in ptrace.h //<> jj debug if (syscall == 2){ //open system call open_cnt++; // printk("called open\n"); } if ((syscall >= NR_SYSCALLS) || (syscall < 0)) result = -ENOSYS; else result = EXECUTE_SYSCALL(syscall, regs); PT_REGS_SET_SYSCALL_RETURN(regs, result); syscall_trace_leave(regs); }
void handle_syscall(struct uml_pt_regs *r) { struct pt_regs *regs = container_of(r, struct pt_regs, regs); int syscall; /* Initialize the syscall number and default return value. */ UPT_SYSCALL_NR(r) = PT_SYSCALL_NR(r->gp); PT_REGS_SET_SYSCALL_RETURN(regs, -ENOSYS); if (syscall_trace_enter(regs)) return; /* Do the seccomp check after ptrace; failures should be fast. */ if (secure_computing(NULL) == -1) return; /* Update the syscall number after orig_ax has potentially been updated * with ptrace. */ UPT_SYSCALL_NR(r) = PT_SYSCALL_NR(r->gp); syscall = UPT_SYSCALL_NR(r); if (syscall >= 0 && syscall <= __NR_syscall_max) PT_REGS_SET_SYSCALL_RETURN(regs, EXECUTE_SYSCALL(syscall, regs)); syscall_trace_leave(regs); }
void handle_syscall(struct uml_pt_regs *r) { struct pt_regs *regs = container_of(r, struct pt_regs, regs); long result; int syscall; syscall_trace(r, 0); /* * This should go in the declaration of syscall, but when I do that, * strace -f -c bash -c 'ls ; ls' breaks, sometimes not tracing * children at all, sometimes hanging when bash doesn't see the first * ls exit. * The assembly looks functionally the same to me. This is * gcc version 4.0.1 20050727 (Red Hat 4.0.1-5) * in case it's a compiler bug. */ syscall = UPT_SYSCALL_NR(r); if ((syscall >= NR_SYSCALLS) || (syscall < 0)) result = -ENOSYS; else result = EXECUTE_SYSCALL(syscall, regs); REGS_SET_SYSCALL_RETURN(r->gp, result); syscall_trace(r, 1); }
long execute_syscall_skas(void *r) { struct pt_regs *regs = r; long res; int syscall; current->thread.nsyscalls++; nsyscalls++; syscall = UPT_SYSCALL_NR(®s->regs); if((syscall >= NR_syscalls) || (syscall < 0)) res = -ENOSYS; else res = EXECUTE_SYSCALL(syscall, regs); return(res); }
long execute_syscall_tt(void *r) { struct pt_regs *regs = r; long res; int syscall; #ifdef CONFIG_SYSCALL_DEBUG current->thread.nsyscalls++; nsyscalls++; #endif syscall = UPT_SYSCALL_NR(®s->regs); if((syscall >= NR_syscalls) || (syscall < 0)) res = -ENOSYS; else res = EXECUTE_SYSCALL(syscall, regs); return(res); }