aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/syscalls.h2
-rw-r--r--kernel/trace/trace_syscalls.c8
2 files changed, 10 insertions, 0 deletions
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 98664db1be47..8e8968e74544 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -158,6 +158,7 @@ extern struct trace_event_functions exit_syscall_print_funcs;
158 static struct syscall_metadata __used \ 158 static struct syscall_metadata __used \
159 __syscall_meta_##sname = { \ 159 __syscall_meta_##sname = { \
160 .name = "sys"#sname, \ 160 .name = "sys"#sname, \
161 .syscall_nr = -1, /* Filled in at boot */ \
161 .nb_args = nb, \ 162 .nb_args = nb, \
162 .types = types_##sname, \ 163 .types = types_##sname, \
163 .args = args_##sname, \ 164 .args = args_##sname, \
@@ -175,6 +176,7 @@ extern struct trace_event_functions exit_syscall_print_funcs;
175 static struct syscall_metadata __used \ 176 static struct syscall_metadata __used \
176 __syscall_meta__##sname = { \ 177 __syscall_meta__##sname = { \
177 .name = "sys_"#sname, \ 178 .name = "sys_"#sname, \
179 .syscall_nr = -1, /* Filled in at boot */ \
178 .nb_args = 0, \ 180 .nb_args = 0, \
179 .enter_event = &event_enter__##sname, \ 181 .enter_event = &event_enter__##sname, \
180 .exit_event = &event_exit__##sname, \ 182 .exit_event = &event_exit__##sname, \
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;