lkml.org 
[lkml]   [2013]   [Nov]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [BUG] 3.13-rc1 kernel crash when enable all tracepoints
On Tue, 26 Nov 2013 12:38:53 +0800
Jovi Zhangwei <jovi.zhangwei@gmail.com> wrote:

> Hi,
>
> I'm not sure this issue already be fixed or not, it can be reproduced
> permanently.
>
> (I didn't use git-bisect yet, you guys might can understand it quickly)
>
> #echo 1 > /sys/kernel/debug/tracing/events/enable
>
> [ 160.472176] BUG: unable to handle kernel NULL pointer dereference
> at (null)
> [ 160.472176] IP: [<ffffffff8132ae40>] strlen+0x0/0x30

I hit this bug last night when testing a fix for another bug. I have a
patch for this too, and will send it out after I put it through my
tests.

You can try it out.

-- Steve

diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
index 52594b2..bdac88c 100644
--- a/include/trace/ftrace.h
+++ b/include/trace/ftrace.h
@@ -372,7 +372,8 @@ ftrace_define_fields_##call(struct ftrace_event_call *event_call) \
__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) ? (src) : "(null)") + 1)

#undef DECLARE_EVENT_CLASS
#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \
@@ -501,7 +502,7 @@ static inline notrace int ftrace_get_offsets_##call( \

#undef __assign_str
#define __assign_str(dst, src) \
- strcpy(__get_str(dst), src);
+ strcpy(__get_str(dst), (src) ? (src) : "(null)");

#undef TP_fast_assign
#define TP_fast_assign(args...) args


\
 
 \ /
  Last update: 2013-11-26 14:21    [W:0.066 / U:0.924 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site