Commit 189f4e6
ftrace: Fix function graph with loading of modules
commit 8a56d77 upstream.
Commit 8c4f3c3 "ftrace: Check module functions being traced on reload"
fixed module loading and unloading with respect to function tracing, but
it missed the function graph tracer. If you perform the following
# cd /sys/kernel/debug/tracing
# echo function_graph > current_tracer
# modprobe nfsd
# echo nop > current_tracer
You'll get the following oops message:
------------[ cut here ]------------
WARNING: CPU: 2 PID: 2910 at /linux.git/kernel/trace/ftrace.c:1640 __ftrace_hash_rec_update.part.35+0x168/0x1b9()
Modules linked in: nfsd exportfs nfs_acl lockd ipt_MASQUERADE sunrpc ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 ip6table_filter ip6_tables uinput snd_hda_codec_idt
CPU: 2 PID: 2910 Comm: bash Not tainted 3.13.0-rc1-test #7
Hardware name: To Be Filled By O.E.M. To Be Filled By O.E.M./To be filled by O.E.M., BIOS SDBLI944.86P 05/08/2007
0000000000000668 ffff8800787efcf8 ffffffff814fe193 ffff88007d500000
0000000000000000 ffff8800787efd38 ffffffff8103b80a 0000000000000668
ffffffff810b2b9a ffffffff81a48370 0000000000000001 ffff880037aea000
Call Trace:
[<ffffffff814fe193>] dump_stack+0x4f/0x7c
[<ffffffff8103b80a>] warn_slowpath_common+0x81/0x9b
[<ffffffff810b2b9a>] ? __ftrace_hash_rec_update.part.35+0x168/0x1b9
[<ffffffff8103b83e>] warn_slowpath_null+0x1a/0x1c
[<ffffffff810b2b9a>] __ftrace_hash_rec_update.part.35+0x168/0x1b9
[<ffffffff81502f89>] ? __mutex_lock_slowpath+0x364/0x364
[<ffffffff810b2cc2>] ftrace_shutdown+0xd7/0x12b
[<ffffffff810b47f0>] unregister_ftrace_graph+0x49/0x78
[<ffffffff810c4b30>] graph_trace_reset+0xe/0x10
[<ffffffff810bf393>] tracing_set_tracer+0xa7/0x26a
[<ffffffff810bf5e1>] tracing_set_trace_write+0x8b/0xbd
[<ffffffff810c501c>] ? ftrace_return_to_handler+0xb2/0xde
[<ffffffff811240a8>] ? __sb_end_write+0x5e/0x5e
[<ffffffff81122aed>] vfs_write+0xab/0xf6
[<ffffffff8150a185>] ftrace_graph_caller+0x85/0x85
[<ffffffff81122dbd>] SyS_write+0x59/0x82
[<ffffffff8150a185>] ftrace_graph_caller+0x85/0x85
[<ffffffff8150a2d2>] system_call_fastpath+0x16/0x1b
---[ end trace 940358030751eafb ]---
The above mentioned commit didn't go far enough. Well, it covered the
function tracer by adding checks in __register_ftrace_function(). The
problem is that the function graph tracer circumvents that (for a slight
efficiency gain when function graph trace is running with a function
tracer. The gain was not worth this).
The problem came with ftrace_startup() which should always be called after
__register_ftrace_function(), if you want this bug to be completely fixed.
Anyway, this solution moves __register_ftrace_function() inside of
ftrace_startup() and removes the need to call them both.
Reported-by: Dave Wysochanski <dwysocha@redhat.com>
Fixes: ed926f9 ("ftrace: Use counters to enable functions to trace")
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>1 parent 4ca74b4 commit 189f4e6
1 file changed
+35
-29
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
367 | 367 | | |
368 | 368 | | |
369 | 369 | | |
370 | | - | |
371 | | - | |
372 | | - | |
373 | 370 | | |
374 | 371 | | |
375 | 372 | | |
| |||
428 | 425 | | |
429 | 426 | | |
430 | 427 | | |
431 | | - | |
432 | | - | |
433 | | - | |
434 | 428 | | |
435 | 429 | | |
436 | 430 | | |
| |||
2088 | 2082 | | |
2089 | 2083 | | |
2090 | 2084 | | |
| 2085 | + | |
2091 | 2086 | | |
2092 | 2087 | | |
2093 | 2088 | | |
2094 | 2089 | | |
| 2090 | + | |
| 2091 | + | |
| 2092 | + | |
| 2093 | + | |
2095 | 2094 | | |
2096 | 2095 | | |
2097 | 2096 | | |
| |||
2113 | 2112 | | |
2114 | 2113 | | |
2115 | 2114 | | |
2116 | | - | |
| 2115 | + | |
2117 | 2116 | | |
2118 | 2117 | | |
| 2118 | + | |
2119 | 2119 | | |
2120 | 2120 | | |
2121 | | - | |
| 2121 | + | |
| 2122 | + | |
| 2123 | + | |
| 2124 | + | |
| 2125 | + | |
2122 | 2126 | | |
2123 | 2127 | | |
2124 | 2128 | | |
| |||
2153 | 2157 | | |
2154 | 2158 | | |
2155 | 2159 | | |
2156 | | - | |
| 2160 | + | |
2157 | 2161 | | |
2158 | 2162 | | |
| 2163 | + | |
2159 | 2164 | | |
2160 | 2165 | | |
2161 | 2166 | | |
| |||
3060 | 3065 | | |
3061 | 3066 | | |
3062 | 3067 | | |
3063 | | - | |
3064 | | - | |
3065 | | - | |
| 3068 | + | |
3066 | 3069 | | |
3067 | 3070 | | |
3068 | 3071 | | |
3069 | 3072 | | |
3070 | 3073 | | |
3071 | 3074 | | |
3072 | | - | |
3073 | 3075 | | |
3074 | 3076 | | |
3075 | 3077 | | |
| |||
3082 | 3084 | | |
3083 | 3085 | | |
3084 | 3086 | | |
3085 | | - | |
3086 | | - | |
3087 | | - | |
| 3087 | + | |
3088 | 3088 | | |
3089 | 3089 | | |
3090 | 3090 | | |
| |||
4290 | 4290 | | |
4291 | 4291 | | |
4292 | 4292 | | |
4293 | | - | |
4294 | | - | |
4295 | | - | |
4296 | | - | |
| 4293 | + | |
| 4294 | + | |
| 4295 | + | |
| 4296 | + | |
| 4297 | + | |
| 4298 | + | |
4297 | 4299 | | |
4298 | | - | |
| 4300 | + | |
| 4301 | + | |
4299 | 4302 | | |
4300 | 4303 | | |
4301 | 4304 | | |
| |||
4695 | 4698 | | |
4696 | 4699 | | |
4697 | 4700 | | |
4698 | | - | |
4699 | | - | |
4700 | | - | |
| 4701 | + | |
4701 | 4702 | | |
4702 | 4703 | | |
4703 | 4704 | | |
| |||
4716 | 4717 | | |
4717 | 4718 | | |
4718 | 4719 | | |
4719 | | - | |
4720 | | - | |
4721 | | - | |
| 4720 | + | |
4722 | 4721 | | |
4723 | 4722 | | |
4724 | 4723 | | |
| |||
4912 | 4911 | | |
4913 | 4912 | | |
4914 | 4913 | | |
| 4914 | + | |
| 4915 | + | |
| 4916 | + | |
| 4917 | + | |
| 4918 | + | |
| 4919 | + | |
| 4920 | + | |
4915 | 4921 | | |
4916 | 4922 | | |
4917 | 4923 | | |
| |||
4938 | 4944 | | |
4939 | 4945 | | |
4940 | 4946 | | |
4941 | | - | |
| 4947 | + | |
4942 | 4948 | | |
4943 | 4949 | | |
4944 | 4950 | | |
| |||
4955 | 4961 | | |
4956 | 4962 | | |
4957 | 4963 | | |
4958 | | - | |
| 4964 | + | |
4959 | 4965 | | |
4960 | 4966 | | |
4961 | 4967 | | |
| |||
0 commit comments