android_kernel_samsung_msm8976/kernel/trace
Rabin Vincent 3ad3add775 tracing/syscalls: Ignore numbers outside NR_syscalls' range
commit 086ba77a6db00ed858ff07451bedee197df868c9 upstream.

ARM has some private syscalls (for example, set_tls(2)) which lie
outside the range of NR_syscalls.  If any of these are called while
syscall tracing is being performed, out-of-bounds array access will
occur in the ftrace and perf sys_{enter,exit} handlers.

 # trace-cmd record -e raw_syscalls:* true && trace-cmd report
 ...
 true-653   [000]   384.675777: sys_enter:            NR 192 (0, 1000, 3, 4000022, ffffffff, 0)
 true-653   [000]   384.675812: sys_exit:             NR 192 = 1995915264
 true-653   [000]   384.675971: sys_enter:            NR 983045 (76f74480, 76f74000, 76f74b28, 76f74480, 76f76f74, 1)
 true-653   [000]   384.675988: sys_exit:             NR 983045 = 0
 ...

 # trace-cmd record -e syscalls:* true
 [   17.289329] Unable to handle kernel paging request at virtual address aaaaaace
 [   17.289590] pgd = 9e71c000
 [   17.289696] [aaaaaace] *pgd=00000000
 [   17.289985] Internal error: Oops: 5 [#1] PREEMPT SMP ARM
 [   17.290169] Modules linked in:
 [   17.290391] CPU: 0 PID: 704 Comm: true Not tainted 3.18.0-rc2+ #21
 [   17.290585] task: 9f4dab00 ti: 9e710000 task.ti: 9e710000
 [   17.290747] PC is at ftrace_syscall_enter+0x48/0x1f8
 [   17.290866] LR is at syscall_trace_enter+0x124/0x184

Fix this by ignoring out-of-NR_syscalls-bounds syscall numbers.

Commit cd0980fc8a "tracing: Check invalid syscall nr while tracing syscalls"
added the check for less than zero, but it should have also checked
for greater than NR_syscalls.

Link: http://lkml.kernel.org/p/1414620418-29472-1-git-send-email-rabin@rab.in

Fixes: cd0980fc8a "tracing: Check invalid syscall nr while tracing syscalls"
Signed-off-by: Rabin Vincent <rabin@rab.in>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-14 08:47:53 -08:00
..
blktrace.c blktrace: fix accounting of partially completed requests 2014-05-30 21:52:11 -07:00
ftrace.c tracing: Fix graph tracer with stack tracer on other archs 2014-07-28 08:00:03 -07:00
Kconfig ring-buffer: Select IRQ_WORK 2013-05-03 19:24:17 -04:00
Makefile
power-traces.c
ring_buffer.c ring-buffer: Fix infinite spin in reading buffer 2014-10-09 12:18:42 -07:00
ring_buffer_benchmark.c
rpm-traces.c
trace.c tracing: Fix wraparound problems in "uptime" trace clock 2014-07-31 12:53:49 -07:00
trace.h ring-buffer: Check if buffer exists before polling 2014-07-17 15:58:03 -07:00
trace_branch.c tracing: Fix the branch tracer that broke with buffer change 2013-03-15 00:35:54 -04:00
trace_clock.c tracing: Fix wraparound problems in "uptime" trace clock 2014-07-31 12:53:49 -07:00
trace_entries.h tracing: Add trace_puts() for even faster trace_printk() tracing 2013-03-15 00:35:55 -04:00
trace_event_perf.c perf/ftrace: Fix paranoid level for enabling function tracer 2013-11-29 11:11:43 -08:00
trace_events.c tracing: Fix array size mismatch in format string 2014-03-31 09:58:12 -07:00
trace_events_filter.c tracing: Change event_filter_read/write to verify i_private != NULL 2013-08-29 09:47:33 -07:00
trace_events_filter_test.h
trace_export.c tracing: Fix array size mismatch in format string 2014-03-31 09:58:12 -07:00
trace_functions.c tracing: Add function probe to trigger stack traces 2013-03-15 00:36:05 -04:00
trace_functions_graph.c tracing: Consolidate max_tr into main trace_array structure 2013-03-15 00:35:40 -04:00
trace_irqsoff.c tracing: Use flag buffer_disabled for irqsoff tracer 2013-08-14 22:59:07 -07:00
trace_kdb.c tracing: Consolidate max_tr into main trace_array structure 2013-03-15 00:35:40 -04:00
trace_kprobe.c tracing/kprobes: Fail to unregister if probe event files are in use 2013-08-29 09:47:34 -07:00
trace_mmiotrace.c tracing: Consolidate max_tr into main trace_array structure 2013-03-15 00:35:40 -04:00
trace_nop.c
trace_output.c Tracing updates for Linux 3.10 2013-04-29 13:55:38 -07:00
trace_output.h tracing: Rename trace_event_mutex to trace_event_sem 2013-03-15 13:22:10 -04:00
trace_printk.c
trace_probe.c
trace_probe.h
trace_sched_switch.c tracing: Consolidate max_tr into main trace_array structure 2013-03-15 00:35:40 -04:00
trace_sched_wakeup.c tracing: Add function-trace option to disable function tracing of latency tracers 2013-03-15 00:36:08 -04:00
trace_selftest.c tracing: Fix bad parameter passed in branch selftest 2013-05-29 16:00:03 -04:00
trace_selftest_dynamic.c
trace_stack.c Tracing updates for Linux 3.10 2013-04-29 13:55:38 -07:00
trace_stat.c tracing: Check return value of tracing_init_dentry() 2013-04-12 23:02:32 -04:00
trace_stat.h
trace_syscalls.c tracing/syscalls: Ignore numbers outside NR_syscalls' range 2014-11-14 08:47:53 -08:00
trace_uprobe.c tracing/uprobes: Fail to unregister if probe event files are in use 2013-08-29 09:47:34 -07:00