diff options
-rw-r--r-- | arch/x86/kernel/ftrace.c | 15 | ||||
-rw-r--r-- | include/trace/syscall.h | 1 | ||||
-rw-r--r-- | kernel/trace/trace_syscalls.c | 1 |
3 files changed, 4 insertions, 13 deletions
diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c index afb31d72618d..0d93d409b8d2 100644 --- a/arch/x86/kernel/ftrace.c +++ b/arch/x86/kernel/ftrace.c | |||
@@ -516,31 +516,24 @@ int syscall_name_to_nr(char *name) | |||
516 | return -1; | 516 | return -1; |
517 | } | 517 | } |
518 | 518 | ||
519 | void arch_init_ftrace_syscalls(void) | 519 | static int __init arch_init_ftrace_syscalls(void) |
520 | { | 520 | { |
521 | int i; | 521 | int i; |
522 | struct syscall_metadata *meta; | 522 | struct syscall_metadata *meta; |
523 | unsigned long **psys_syscall_table = &sys_call_table; | 523 | unsigned long **psys_syscall_table = &sys_call_table; |
524 | static atomic_t refs; | ||
525 | |||
526 | if (atomic_inc_return(&refs) != 1) | ||
527 | goto end; | ||
528 | 524 | ||
529 | syscalls_metadata = kzalloc(sizeof(*syscalls_metadata) * | 525 | syscalls_metadata = kzalloc(sizeof(*syscalls_metadata) * |
530 | FTRACE_SYSCALL_MAX, GFP_KERNEL); | 526 | FTRACE_SYSCALL_MAX, GFP_KERNEL); |
531 | if (!syscalls_metadata) { | 527 | if (!syscalls_metadata) { |
532 | WARN_ON(1); | 528 | WARN_ON(1); |
533 | return; | 529 | return -ENOMEM; |
534 | } | 530 | } |
535 | 531 | ||
536 | for (i = 0; i < FTRACE_SYSCALL_MAX; i++) { | 532 | for (i = 0; i < FTRACE_SYSCALL_MAX; i++) { |
537 | meta = find_syscall_meta(psys_syscall_table[i]); | 533 | meta = find_syscall_meta(psys_syscall_table[i]); |
538 | syscalls_metadata[i] = meta; | 534 | syscalls_metadata[i] = meta; |
539 | } | 535 | } |
540 | return; | 536 | return 0; |
541 | |||
542 | /* Paranoid: avoid overflow */ | ||
543 | end: | ||
544 | atomic_dec(&refs); | ||
545 | } | 537 | } |
538 | arch_initcall(arch_init_ftrace_syscalls); | ||
546 | #endif | 539 | #endif |
diff --git a/include/trace/syscall.h b/include/trace/syscall.h index 8cfe515cbc47..c55fcce4fbb2 100644 --- a/include/trace/syscall.h +++ b/include/trace/syscall.h | |||
@@ -19,7 +19,6 @@ struct syscall_metadata { | |||
19 | }; | 19 | }; |
20 | 20 | ||
21 | #ifdef CONFIG_FTRACE_SYSCALLS | 21 | #ifdef CONFIG_FTRACE_SYSCALLS |
22 | extern void arch_init_ftrace_syscalls(void); | ||
23 | extern struct syscall_metadata *syscall_nr_to_meta(int nr); | 22 | extern struct syscall_metadata *syscall_nr_to_meta(int nr); |
24 | extern void start_ftrace_syscalls(void); | 23 | extern void start_ftrace_syscalls(void); |
25 | extern void stop_ftrace_syscalls(void); | 24 | extern void stop_ftrace_syscalls(void); |
diff --git a/kernel/trace/trace_syscalls.c b/kernel/trace/trace_syscalls.c index 5e579645ac86..08aed439feaf 100644 --- a/kernel/trace/trace_syscalls.c +++ b/kernel/trace/trace_syscalls.c | |||
@@ -106,7 +106,6 @@ void start_ftrace_syscalls(void) | |||
106 | if (++refcount != 1) | 106 | if (++refcount != 1) |
107 | goto unlock; | 107 | goto unlock; |
108 | 108 | ||
109 | arch_init_ftrace_syscalls(); | ||
110 | read_lock_irqsave(&tasklist_lock, flags); | 109 | read_lock_irqsave(&tasklist_lock, flags); |
111 | 110 | ||
112 | do_each_thread(g, t) { | 111 | do_each_thread(g, t) { |