android_kernel_google_msm/kernel/trace
Rabin Vincent b767a16393 tracing/syscalls: Ignore numbers outside NR_syscalls' range
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"
Cc: stable@vger.kernel.org # 2.6.33+
Signed-off-by: Rabin Vincent <rabin@rab.in>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>

Change-Id: I512142f8f1e1b2a8dc063209666dbce9737377e7
2016-10-29 23:12:11 +08:00
..
blktrace.c block: ioctl support for sanitize in eMMC 4.5 2013-02-20 01:32:26 -08:00
ftrace.c ftrace: Fix function_graph for archs that test ftrace_trace_function 2012-03-13 15:07:37 -04:00
gpu-traces.c trace/events: add gpu trace events 2013-04-18 16:08:19 -07:00
Kconfig trace/events: add gpu trace events 2013-04-18 16:08:19 -07:00
Makefile trace/events: add gpu trace events 2013-04-18 16:08:19 -07:00
power-traces.c
ring_buffer.c tracing/ring-buffer: Only have tracing_on disable tracing buffers 2012-02-22 15:50:28 -05:00
ring_buffer_benchmark.c
rpm-traces.c
trace.c kernel: trace.c: Initialize page2 to prevent compiler error 2013-02-20 01:32:27 -08:00
trace.h tracing: Fix build breakage without CONFIG_PERF_EVENTS (again) 2012-04-13 21:37:04 -04:00
trace_branch.c
trace_clock.c
trace_cpu_freq_switch.c trace: cpu_freq_switch: Add profiler for CPU frequency switch times 2013-02-08 15:14:30 -08:00
trace_entries.h Merge branch 'tip/perf/urgent' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace into perf/urgent 2012-03-24 08:19:09 +01:00
trace_event_perf.c msm: null pointer dereferencing 2016-01-21 15:15:08 -08:00
trace_events.c tracing: Do not enable function event with enable 2012-05-10 15:55:43 -04:00
trace_events_filter.c tracing/filter: Correct potential uninitialized variable 2013-02-08 15:14:34 -08:00
trace_events_filter_test.h
trace_export.c tracing: Do not enable function event with enable 2012-05-10 15:55:43 -04:00
trace_functions.c
trace_functions_graph.c
trace_irqsoff.c
trace_kdb.c
trace_kprobe.c ftrace, perf: Add add/del tracepoint perf registration actions 2012-02-21 11:08:25 -05:00
trace_mmiotrace.c
trace_nop.c
trace_output.c tracing: Fix stacktrace of latency tracers (irqsoff and friends) 2012-04-19 17:00:13 -04:00
trace_output.h
trace_printk.c
trace_sched_switch.c
trace_sched_wakeup.c
trace_selftest.c
trace_selftest_dynamic.c
trace_stack.c
trace_stat.c
trace_stat.h
trace_syscalls.c tracing/syscalls: Ignore numbers outside NR_syscalls' range 2016-10-29 23:12:11 +08:00
trace_workqueue.c