aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace_syscalls.c
diff options
context:
space:
mode:
authorIan Munsie <imunsie@au1.ibm.com>2011-02-02 22:27:20 -0500
committerSteven Rostedt <rostedt@goodmis.org>2011-02-07 21:24:44 -0500
commitba976970c79fd2fbfe1a4b3b6766a318f4eb9d4c (patch)
tree3cb30bb45aa6302cce39849d281bba7e8e294c62 /kernel/trace/trace_syscalls.c
parent075de90c46562de1435db16c2129ec4ff92e5bd2 (diff)
tracing/syscalls: Don't add events for unmapped syscalls
FTRACE_SYSCALLS would create events for each and every system call, even if it had failed to map the system call's name with it's number. This resulted in a number of events being created that would not behave as expected. This could happen, for example, on architectures who's symbol names are unusual and will not match the system call name. It could also happen with system calls which were mapped to sys_ni_syscall. This patch changes the default system call number in the metadata to -1. If the system call name from the metadata is not successfully mapped to a system call number during boot, than the event initialisation routine will now return an error, preventing the event from being created. Signed-off-by: Ian Munsie <imunsie@au1.ibm.com> LKML-Reference: <1296703645-18718-2-git-send-email-imunsie@au1.ibm.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace/trace_syscalls.c')
-rw-r--r--kernel/trace/trace_syscalls.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/kernel/trace/trace_syscalls.c b/kernel/trace/trace_syscalls.c
index 5c9fe08d2093..a9ceabd52247 100644
--- a/kernel/trace/trace_syscalls.c
+++ b/kernel/trace/trace_syscalls.c
@@ -424,6 +424,14 @@ void unreg_event_syscall_exit(struct ftrace_event_call *call)
424int init_syscall_trace(struct ftrace_event_call *call) 424int init_syscall_trace(struct ftrace_event_call *call)
425{ 425{
426 int id; 426 int id;
427 int num;
428
429 num = ((struct syscall_metadata *)call->data)->syscall_nr;
430 if (num < 0 || num >= NR_syscalls) {
431 pr_debug("syscall %s metadata not mapped, disabling ftrace event\n",
432 ((struct syscall_metadata *)call->data)->name);
433 return -ENOSYS;
434 }
427 435
428 if (set_syscall_print_fmt(call) < 0) 436 if (set_syscall_print_fmt(call) < 0)
429 return -ENOMEM; 437 return -ENOMEM;