]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
3.4-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 2 Dec 2013 01:50:16 +0000 (17:50 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 2 Dec 2013 01:50:16 +0000 (17:50 -0800)
added patches:
tracing-allow-events-to-have-null-strings.patch

queue-3.4/series
queue-3.4/tracing-allow-events-to-have-null-strings.patch [new file with mode: 0644]

index aaa92efdba8c8944e918a751492e3d7f40cfbec1..555d1a6d1ac14059d18ef65130c55c691d1af6dd 100644 (file)
@@ -50,3 +50,4 @@ md-fix-calculation-of-stacking-limits-on-level-change.patch
 powerpc-signals-improved-mark-vsx-not-saved-with-small-contexts-fix.patch
 cpuset-fix-memory-allocator-deadlock.patch
 alsa-hda-realtek-set-pcbeep-amp-for-alc668.patch
+tracing-allow-events-to-have-null-strings.patch
diff --git a/queue-3.4/tracing-allow-events-to-have-null-strings.patch b/queue-3.4/tracing-allow-events-to-have-null-strings.patch
new file mode 100644 (file)
index 0000000..f5a7b53
--- /dev/null
@@ -0,0 +1,89 @@
+From 4e58e54754dc1fec21c3a9e824bc108b05fdf46e Mon Sep 17 00:00:00 2001
+From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>
+Date: Tue, 26 Nov 2013 09:22:54 -0500
+Subject: tracing: Allow events to have NULL strings
+
+From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>
+
+commit 4e58e54754dc1fec21c3a9e824bc108b05fdf46e upstream.
+
+If an TRACE_EVENT() uses __assign_str() or __get_str on a NULL pointer
+then the following oops will happen:
+
+BUG: unable to handle kernel NULL pointer dereference at   (null)
+IP: [<c127a17b>] strlen+0x10/0x1a
+*pde = 00000000 ^M
+Oops: 0000 [#1] PREEMPT SMP
+Modules linked in:
+CPU: 1 PID: 0 Comm: swapper/1 Not tainted 3.13.0-rc1-test+ #2
+Hardware name:                  /DG965MQ, BIOS MQ96510J.86A.0372.2006.0605.1717 06/05/2006^M
+task: f5cde9f0 ti: f5e5e000 task.ti: f5e5e000
+EIP: 0060:[<c127a17b>] EFLAGS: 00210046 CPU: 1
+EIP is at strlen+0x10/0x1a
+EAX: 00000000 EBX: c2472da8 ECX: ffffffff EDX: c2472da8
+ESI: c1c5e5fc EDI: 00000000 EBP: f5e5fe84 ESP: f5e5fe80
+ DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068
+CR0: 8005003b CR2: 00000000 CR3: 01f32000 CR4: 000007d0
+Stack:
+ f5f18b90 f5e5feb8 c10687a8 0759004f 00000005 00000005 00000005 00200046
+ 00000002 00000000 c1082a93 f56c7e28 c2472da8 c1082a93 f5e5fee4 c106bc61^M
+ 00000000 c1082a93 00000000 00000000 00000001 00200046 00200082 00000000
+Call Trace:
+ [<c10687a8>] ftrace_raw_event_lock+0x39/0xc0
+ [<c1082a93>] ? ktime_get+0x29/0x69
+ [<c1082a93>] ? ktime_get+0x29/0x69
+ [<c106bc61>] lock_release+0x57/0x1a5
+ [<c1082a93>] ? ktime_get+0x29/0x69
+ [<c10824dd>] read_seqcount_begin.constprop.7+0x4d/0x75
+ [<c1082a93>] ? ktime_get+0x29/0x69^M
+ [<c1082a93>] ktime_get+0x29/0x69
+ [<c108a46a>] __tick_nohz_idle_enter+0x1e/0x426
+ [<c10690e8>] ? lock_release_holdtime.part.19+0x48/0x4d
+ [<c10bc184>] ? time_hardirqs_off+0xe/0x28
+ [<c1068c82>] ? trace_hardirqs_off_caller+0x3f/0xaf
+ [<c108a8cb>] tick_nohz_idle_enter+0x59/0x62
+ [<c1079242>] cpu_startup_entry+0x64/0x192
+ [<c102299c>] start_secondary+0x277/0x27c
+Code: 90 89 c6 89 d0 88 c4 ac 38 e0 74 09 84 c0 75 f7 be 01 00 00 00 89 f0 48 5e 5d c3 55 89 e5 57 66 66 66 66 90 83 c9 ff 89 c7 31 c0 <f2> ae f7 d1 8d 41 ff 5f 5d c3 55 89 e5 57 66 66 66 66 90 31 ff
+EIP: [<c127a17b>] strlen+0x10/0x1a SS:ESP 0068:f5e5fe80
+CR2: 0000000000000000
+---[ end trace 01bc47bf519ec1b2 ]---
+
+New tracepoints have been added that have allowed for NULL pointers
+being assigned to strings. To fix this, change the TRACE_EVENT() code
+to check for NULL and if it is, it will assign "(null)" to it instead
+(similar to what glibc printf does).
+
+Reported-by: Shuah Khan <shuah.kh@samsung.com>
+Reported-by: Jovi Zhangwei <jovi.zhangwei@gmail.com>
+Link: http://lkml.kernel.org/r/CAGdX0WFeEuy+DtpsJzyzn0343qEEjLX97+o1VREFkUEhndC+5Q@mail.gmail.com
+Link: http://lkml.kernel.org/r/528D6972.9010702@samsung.com
+Fixes: 9cbf117662e2 ("tracing/events: provide string with undefined size support")
+Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ include/trace/ftrace.h |    5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+--- a/include/trace/ftrace.h
++++ b/include/trace/ftrace.h
+@@ -379,7 +379,8 @@ ftrace_define_fields_##call(struct ftrac
+       __data_size += (len) * sizeof(type);
+ #undef __string
+-#define __string(item, src) __dynamic_array(char, item, strlen(src) + 1)
++#define __string(item, src) __dynamic_array(char, item,                       \
++                  strlen((src) ? (const char *)(src) : "(null)") + 1)
+ #undef DECLARE_EVENT_CLASS
+ #define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print)        \
+@@ -504,7 +505,7 @@ static inline notrace int ftrace_get_off
+ #undef __assign_str
+ #define __assign_str(dst, src)                                                \
+-      strcpy(__get_str(dst), src);
++      strcpy(__get_str(dst), (src) ? (const char *)(src) : "(null)");
+ #undef TP_fast_assign
+ #define TP_fast_assign(args...) args