parisc: Add syscall tracepoint support
This patch adds support for the TIF_SYSCALL_TRACEPOINT on the parisc architecture. Basically, it calls the appropriate tracepoints on syscall entry and exit. Signed-off-by: Helge Deller <deller@gmx.de>
This commit is contained in:
parent
f6c658df63
commit
fc79168a7c
|
@ -6,6 +6,7 @@ config PARISC
|
||||||
select HAVE_OPROFILE
|
select HAVE_OPROFILE
|
||||||
select HAVE_FUNCTION_TRACER
|
select HAVE_FUNCTION_TRACER
|
||||||
select HAVE_FUNCTION_GRAPH_TRACER
|
select HAVE_FUNCTION_GRAPH_TRACER
|
||||||
|
select HAVE_SYSCALL_TRACEPOINTS
|
||||||
select ARCH_WANT_FRAME_POINTERS
|
select ARCH_WANT_FRAME_POINTERS
|
||||||
select RTC_CLASS
|
select RTC_CLASS
|
||||||
select RTC_DRV_GENERIC
|
select RTC_DRV_GENERIC
|
||||||
|
|
|
@ -6,6 +6,8 @@ extern void mcount(void);
|
||||||
|
|
||||||
#define MCOUNT_INSN_SIZE 4
|
#define MCOUNT_INSN_SIZE 4
|
||||||
|
|
||||||
|
extern unsigned long sys_call_table[];
|
||||||
|
|
||||||
extern unsigned long return_address(unsigned int);
|
extern unsigned long return_address(unsigned int);
|
||||||
|
|
||||||
#define ftrace_return_address(n) return_address(n)
|
#define ftrace_return_address(n) return_address(n)
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
#include <linux/err.h>
|
#include <linux/err.h>
|
||||||
#include <asm/ptrace.h>
|
#include <asm/ptrace.h>
|
||||||
|
|
||||||
|
#define NR_syscalls (__NR_Linux_syscalls)
|
||||||
|
|
||||||
static inline long syscall_get_nr(struct task_struct *tsk,
|
static inline long syscall_get_nr(struct task_struct *tsk,
|
||||||
struct pt_regs *regs)
|
struct pt_regs *regs)
|
||||||
{
|
{
|
||||||
|
@ -33,12 +35,19 @@ static inline void syscall_get_arguments(struct task_struct *tsk,
|
||||||
args[1] = regs->gr[25];
|
args[1] = regs->gr[25];
|
||||||
case 1:
|
case 1:
|
||||||
args[0] = regs->gr[26];
|
args[0] = regs->gr[26];
|
||||||
|
case 0:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
BUG();
|
BUG();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline long syscall_get_return_value(struct task_struct *task,
|
||||||
|
struct pt_regs *regs)
|
||||||
|
{
|
||||||
|
return regs->gr[28];
|
||||||
|
}
|
||||||
|
|
||||||
static inline void syscall_set_return_value(struct task_struct *task,
|
static inline void syscall_set_return_value(struct task_struct *task,
|
||||||
struct pt_regs *regs,
|
struct pt_regs *regs,
|
||||||
int error, long val)
|
int error, long val)
|
||||||
|
|
|
@ -55,6 +55,7 @@ struct thread_info {
|
||||||
#define TIF_SINGLESTEP 9 /* single stepping? */
|
#define TIF_SINGLESTEP 9 /* single stepping? */
|
||||||
#define TIF_BLOCKSTEP 10 /* branch stepping? */
|
#define TIF_BLOCKSTEP 10 /* branch stepping? */
|
||||||
#define TIF_SECCOMP 11 /* secure computing */
|
#define TIF_SECCOMP 11 /* secure computing */
|
||||||
|
#define TIF_SYSCALL_TRACEPOINT 12 /* syscall tracepoint instrumentation */
|
||||||
|
|
||||||
#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
|
#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
|
||||||
#define _TIF_SIGPENDING (1 << TIF_SIGPENDING)
|
#define _TIF_SIGPENDING (1 << TIF_SIGPENDING)
|
||||||
|
@ -66,12 +67,13 @@ struct thread_info {
|
||||||
#define _TIF_SINGLESTEP (1 << TIF_SINGLESTEP)
|
#define _TIF_SINGLESTEP (1 << TIF_SINGLESTEP)
|
||||||
#define _TIF_BLOCKSTEP (1 << TIF_BLOCKSTEP)
|
#define _TIF_BLOCKSTEP (1 << TIF_BLOCKSTEP)
|
||||||
#define _TIF_SECCOMP (1 << TIF_SECCOMP)
|
#define _TIF_SECCOMP (1 << TIF_SECCOMP)
|
||||||
|
#define _TIF_SYSCALL_TRACEPOINT (1 << TIF_SYSCALL_TRACEPOINT)
|
||||||
|
|
||||||
#define _TIF_USER_WORK_MASK (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | \
|
#define _TIF_USER_WORK_MASK (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | \
|
||||||
_TIF_NEED_RESCHED)
|
_TIF_NEED_RESCHED)
|
||||||
#define _TIF_SYSCALL_TRACE_MASK (_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP | \
|
#define _TIF_SYSCALL_TRACE_MASK (_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP | \
|
||||||
_TIF_BLOCKSTEP | _TIF_SYSCALL_AUDIT | \
|
_TIF_BLOCKSTEP | _TIF_SYSCALL_AUDIT | \
|
||||||
_TIF_SECCOMP)
|
_TIF_SECCOMP | _TIF_SYSCALL_TRACEPOINT)
|
||||||
|
|
||||||
#ifdef CONFIG_64BIT
|
#ifdef CONFIG_64BIT
|
||||||
# ifdef CONFIG_COMPAT
|
# ifdef CONFIG_COMPAT
|
||||||
|
|
|
@ -30,6 +30,9 @@
|
||||||
/* PSW bits we allow the debugger to modify */
|
/* PSW bits we allow the debugger to modify */
|
||||||
#define USER_PSW_BITS (PSW_N | PSW_B | PSW_V | PSW_CB)
|
#define USER_PSW_BITS (PSW_N | PSW_B | PSW_V | PSW_CB)
|
||||||
|
|
||||||
|
#define CREATE_TRACE_POINTS
|
||||||
|
#include <trace/events/syscalls.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Called by kernel/ptrace.c when detaching..
|
* Called by kernel/ptrace.c when detaching..
|
||||||
*
|
*
|
||||||
|
@ -283,6 +286,10 @@ long do_syscall_trace_enter(struct pt_regs *regs)
|
||||||
regs->gr[20] = -1UL;
|
regs->gr[20] = -1UL;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
#ifdef CONFIG_HAVE_SYSCALL_TRACEPOINTS
|
||||||
|
if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
|
||||||
|
trace_sys_enter(regs, regs->gr[20]);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_64BIT
|
#ifdef CONFIG_64BIT
|
||||||
if (!is_compat_task())
|
if (!is_compat_task())
|
||||||
|
@ -311,6 +318,11 @@ void do_syscall_trace_exit(struct pt_regs *regs)
|
||||||
|
|
||||||
audit_syscall_exit(regs);
|
audit_syscall_exit(regs);
|
||||||
|
|
||||||
|
#ifdef CONFIG_HAVE_SYSCALL_TRACEPOINTS
|
||||||
|
if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
|
||||||
|
trace_sys_exit(regs, regs->gr[20]);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (stepping || test_thread_flag(TIF_SYSCALL_TRACE))
|
if (stepping || test_thread_flag(TIF_SYSCALL_TRACE))
|
||||||
tracehook_report_syscall_exit(regs, stepping);
|
tracehook_report_syscall_exit(regs, stepping);
|
||||||
}
|
}
|
||||||
|
|
|
@ -912,6 +912,7 @@ END(lws_table)
|
||||||
|
|
||||||
.align 8
|
.align 8
|
||||||
ENTRY(sys_call_table)
|
ENTRY(sys_call_table)
|
||||||
|
.export sys_call_table,data
|
||||||
#include "syscall_table.S"
|
#include "syscall_table.S"
|
||||||
END(sys_call_table)
|
END(sys_call_table)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue