Esempio n. 1
0
asmlinkage int syscall_trace_enter(struct pt_regs *regs)
{
	unsigned int saved_syscallno = regs->syscallno;

	/* Do the secure computing check first; failures should be fast. */
	if (secure_computing(regs->syscallno) == -1)
		return RET_SKIP_SYSCALL_TRACE;

	if (test_thread_flag_relaxed(TIF_SYSCALL_TRACE))
		tracehook_report_syscall(regs, PTRACE_SYSCALL_ENTER);

	if (IS_SKIP_SYSCALL(regs->syscallno)) {
		/*
		 * RESTRICTION: we can't modify a return value of user
		 * issued syscall(-1) here. In order to ease this flavor,
		 * we need to treat whatever value in x0 as a return value,
		 * but this might result in a bogus value being returned.
		 */
		/*
		 * NOTE: syscallno may also be set to -1 if fatal signal is
		 * detected in tracehook_report_syscall_entry(), but since
		 * a value set to x0 here is not used in this case, we may
		 * neglect the case.
		 */
		if (!test_thread_flag_relaxed(TIF_SYSCALL_TRACE) ||
				(IS_SKIP_SYSCALL(saved_syscallno)))
			regs->regs[0] = -ENOSYS;
	}

	audit_syscall_entry(syscall_get_arch(), regs->syscallno,
		regs->orig_x0, regs->regs[1], regs->regs[2], regs->regs[3]);

	return regs->syscallno;
}
Esempio n. 2
0
asmlinkage void syscall_trace_exit(struct pt_regs *regs)
{
	audit_syscall_exit(regs);

	if (test_thread_flag_relaxed(TIF_SYSCALL_TRACEPOINT))
		trace_sys_exit(regs, regs_return_value(regs));

	if (test_thread_flag_relaxed(TIF_SYSCALL_TRACE))
		tracehook_report_syscall(regs, PTRACE_SYSCALL_EXIT);
}
Esempio n. 3
0
asmlinkage int syscall_trace_enter(struct pt_regs *regs)
{
	/* Do the secure computing check first; failures should be fast. */
	if (secure_computing() == -1)
		return -1;

	if (test_thread_flag_relaxed(TIF_SYSCALL_TRACE))
		tracehook_report_syscall(regs, PTRACE_SYSCALL_ENTER);

	if (test_thread_flag_relaxed(TIF_SYSCALL_TRACEPOINT))
		trace_sys_enter(regs, regs->syscallno);

	audit_syscall_entry(syscall_get_arch(), regs->syscallno,
		regs->orig_x0, regs->regs[1], regs->regs[2], regs->regs[3]);

	return regs->syscallno;
}