diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-04-14 13:50:55 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-04-14 13:50:55 -0400 |
commit | 3c91930f0cbd54d522d8844b221c36199a2dc11e (patch) | |
tree | b505e2c70afd0dcf8704bfdd91e3d5011f7ccc46 /kernel | |
parent | 935d8aabd4331f47a89c3e1daa5779d23cf244ee (diff) | |
parent | 7f49ef69db6bbf756c0abca7e9b65b32e999eec8 (diff) |
Merge tag 'trace-fixes-v3.9-rc-v3' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace
Pull ftrace fixes from Steven Rostedt:
"Namhyung Kim found and fixed a bug that can crash the kernel by simply
doing: echo 1234 | tee -a /sys/kernel/debug/tracing/set_ftrace_pid
Luckily, this can only be done by root, but still is a nasty bug."
* tag 'trace-fixes-v3.9-rc-v3' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
ftrace: Move ftrace_filter_lseek out of CONFIG_DYNAMIC_FTRACE section
tracing: Fix possible NULL pointer dereferences
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/trace/ftrace.c | 36 | ||||
-rw-r--r-- | kernel/trace/trace_stack.c | 2 |
2 files changed, 19 insertions, 19 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 926ebfb74936..2461ede45a8d 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c | |||
@@ -1052,6 +1052,19 @@ static __init void ftrace_profile_debugfs(struct dentry *d_tracer) | |||
1052 | 1052 | ||
1053 | static struct pid * const ftrace_swapper_pid = &init_struct_pid; | 1053 | static struct pid * const ftrace_swapper_pid = &init_struct_pid; |
1054 | 1054 | ||
1055 | loff_t | ||
1056 | ftrace_filter_lseek(struct file *file, loff_t offset, int whence) | ||
1057 | { | ||
1058 | loff_t ret; | ||
1059 | |||
1060 | if (file->f_mode & FMODE_READ) | ||
1061 | ret = seq_lseek(file, offset, whence); | ||
1062 | else | ||
1063 | file->f_pos = ret = 1; | ||
1064 | |||
1065 | return ret; | ||
1066 | } | ||
1067 | |||
1055 | #ifdef CONFIG_DYNAMIC_FTRACE | 1068 | #ifdef CONFIG_DYNAMIC_FTRACE |
1056 | 1069 | ||
1057 | #ifndef CONFIG_FTRACE_MCOUNT_RECORD | 1070 | #ifndef CONFIG_FTRACE_MCOUNT_RECORD |
@@ -2612,7 +2625,7 @@ static void ftrace_filter_reset(struct ftrace_hash *hash) | |||
2612 | * routine, you can use ftrace_filter_write() for the write | 2625 | * routine, you can use ftrace_filter_write() for the write |
2613 | * routine if @flag has FTRACE_ITER_FILTER set, or | 2626 | * routine if @flag has FTRACE_ITER_FILTER set, or |
2614 | * ftrace_notrace_write() if @flag has FTRACE_ITER_NOTRACE set. | 2627 | * ftrace_notrace_write() if @flag has FTRACE_ITER_NOTRACE set. |
2615 | * ftrace_regex_lseek() should be used as the lseek routine, and | 2628 | * ftrace_filter_lseek() should be used as the lseek routine, and |
2616 | * release must call ftrace_regex_release(). | 2629 | * release must call ftrace_regex_release(). |
2617 | */ | 2630 | */ |
2618 | int | 2631 | int |
@@ -2696,19 +2709,6 @@ ftrace_notrace_open(struct inode *inode, struct file *file) | |||
2696 | inode, file); | 2709 | inode, file); |
2697 | } | 2710 | } |
2698 | 2711 | ||
2699 | loff_t | ||
2700 | ftrace_regex_lseek(struct file *file, loff_t offset, int whence) | ||
2701 | { | ||
2702 | loff_t ret; | ||
2703 | |||
2704 | if (file->f_mode & FMODE_READ) | ||
2705 | ret = seq_lseek(file, offset, whence); | ||
2706 | else | ||
2707 | file->f_pos = ret = 1; | ||
2708 | |||
2709 | return ret; | ||
2710 | } | ||
2711 | |||
2712 | static int ftrace_match(char *str, char *regex, int len, int type) | 2712 | static int ftrace_match(char *str, char *regex, int len, int type) |
2713 | { | 2713 | { |
2714 | int matched = 0; | 2714 | int matched = 0; |
@@ -3570,7 +3570,7 @@ static const struct file_operations ftrace_filter_fops = { | |||
3570 | .open = ftrace_filter_open, | 3570 | .open = ftrace_filter_open, |
3571 | .read = seq_read, | 3571 | .read = seq_read, |
3572 | .write = ftrace_filter_write, | 3572 | .write = ftrace_filter_write, |
3573 | .llseek = ftrace_regex_lseek, | 3573 | .llseek = ftrace_filter_lseek, |
3574 | .release = ftrace_regex_release, | 3574 | .release = ftrace_regex_release, |
3575 | }; | 3575 | }; |
3576 | 3576 | ||
@@ -3578,7 +3578,7 @@ static const struct file_operations ftrace_notrace_fops = { | |||
3578 | .open = ftrace_notrace_open, | 3578 | .open = ftrace_notrace_open, |
3579 | .read = seq_read, | 3579 | .read = seq_read, |
3580 | .write = ftrace_notrace_write, | 3580 | .write = ftrace_notrace_write, |
3581 | .llseek = ftrace_regex_lseek, | 3581 | .llseek = ftrace_filter_lseek, |
3582 | .release = ftrace_regex_release, | 3582 | .release = ftrace_regex_release, |
3583 | }; | 3583 | }; |
3584 | 3584 | ||
@@ -3783,8 +3783,8 @@ static const struct file_operations ftrace_graph_fops = { | |||
3783 | .open = ftrace_graph_open, | 3783 | .open = ftrace_graph_open, |
3784 | .read = seq_read, | 3784 | .read = seq_read, |
3785 | .write = ftrace_graph_write, | 3785 | .write = ftrace_graph_write, |
3786 | .llseek = ftrace_filter_lseek, | ||
3786 | .release = ftrace_graph_release, | 3787 | .release = ftrace_graph_release, |
3787 | .llseek = seq_lseek, | ||
3788 | }; | 3788 | }; |
3789 | #endif /* CONFIG_FUNCTION_GRAPH_TRACER */ | 3789 | #endif /* CONFIG_FUNCTION_GRAPH_TRACER */ |
3790 | 3790 | ||
@@ -4439,7 +4439,7 @@ static const struct file_operations ftrace_pid_fops = { | |||
4439 | .open = ftrace_pid_open, | 4439 | .open = ftrace_pid_open, |
4440 | .write = ftrace_pid_write, | 4440 | .write = ftrace_pid_write, |
4441 | .read = seq_read, | 4441 | .read = seq_read, |
4442 | .llseek = seq_lseek, | 4442 | .llseek = ftrace_filter_lseek, |
4443 | .release = ftrace_pid_release, | 4443 | .release = ftrace_pid_release, |
4444 | }; | 4444 | }; |
4445 | 4445 | ||
diff --git a/kernel/trace/trace_stack.c b/kernel/trace/trace_stack.c index 42ca822fc701..83a8b5b7bd35 100644 --- a/kernel/trace/trace_stack.c +++ b/kernel/trace/trace_stack.c | |||
@@ -322,7 +322,7 @@ static const struct file_operations stack_trace_filter_fops = { | |||
322 | .open = stack_trace_filter_open, | 322 | .open = stack_trace_filter_open, |
323 | .read = seq_read, | 323 | .read = seq_read, |
324 | .write = ftrace_filter_write, | 324 | .write = ftrace_filter_write, |
325 | .llseek = ftrace_regex_lseek, | 325 | .llseek = ftrace_filter_lseek, |
326 | .release = ftrace_regex_release, | 326 | .release = ftrace_regex_release, |
327 | }; | 327 | }; |
328 | 328 | ||