diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-11-26 21:04:21 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-11-26 21:04:21 -0500 |
| commit | 8ae516aa8b8161254d3e402b3348b2a9b8d1efd0 (patch) | |
| tree | 532a8665fb0a60fb62a0a27656a00d8829454cd1 /include | |
| parent | 4f9e5df211a8591b3fb5c154ecc7ec5d4ecd6b79 (diff) | |
| parent | 8a56d7761d2d041ae5e8215d20b4167d8aa93f51 (diff) | |
Merge tag 'trace-fixes-v3.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace
Pull tracing fixes from Steven Rostedt:
"This includes two fixes.
1) is a bug fix that happens when root does the following:
echo function_graph > current_tracer
modprobe foo
echo nop > current_tracer
This causes the ftrace internal accounting to get screwed up and
crashes ftrace, preventing the user from using the function tracer
after that.
2) if a TRACE_EVENT has a string field, and NULL is given for it.
The internal trace event code does a strlen() and strcpy() on the
source of field. If it is NULL it causes the system to oops.
This bug has been there since 2.6.31, but no TRACE_EVENT ever passed
in a NULL to the string field, until now"
* tag 'trace-fixes-v3.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
ftrace: Fix function graph with loading of modules
tracing: Allow events to have NULL strings
Diffstat (limited to 'include')
| -rw-r--r-- | include/trace/ftrace.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h index 52594b20179e..d17a35c6537e 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) \ | |||
| 372 | __data_size += (len) * sizeof(type); | 372 | __data_size += (len) * sizeof(type); |
| 373 | 373 | ||
| 374 | #undef __string | 374 | #undef __string |
| 375 | #define __string(item, src) __dynamic_array(char, item, strlen(src) + 1) | 375 | #define __string(item, src) __dynamic_array(char, item, \ |
| 376 | strlen((src) ? (const char *)(src) : "(null)") + 1) | ||
| 376 | 377 | ||
| 377 | #undef DECLARE_EVENT_CLASS | 378 | #undef DECLARE_EVENT_CLASS |
| 378 | #define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \ | 379 | #define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \ |
| @@ -501,7 +502,7 @@ static inline notrace int ftrace_get_offsets_##call( \ | |||
| 501 | 502 | ||
| 502 | #undef __assign_str | 503 | #undef __assign_str |
| 503 | #define __assign_str(dst, src) \ | 504 | #define __assign_str(dst, src) \ |
| 504 | strcpy(__get_str(dst), src); | 505 | strcpy(__get_str(dst), (src) ? (const char *)(src) : "(null)"); |
| 505 | 506 | ||
| 506 | #undef TP_fast_assign | 507 | #undef TP_fast_assign |
| 507 | #define TP_fast_assign(args...) args | 508 | #define TP_fast_assign(args...) args |
