tracing/core: fix early free of cpumasks
PATCH 1/1 tracing/core: fix early free of cpumasks
Impact: fix weird bugs with tracing cpumasks
While ring-buffer allocation, the cpumasks are allocated too, including the tracing cpumask and the per-cpu file mask handler.
But these cpumasks are freed accidentally just after.
Fix it.
--- kernel/trace/trace.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
kernel/trace/trace.c +2 -1
@@ -4125,7 +4125,8 @@ __init static int tracer_alloc_buffers(void) &trace_panic_notifier);register_die_notifier (&trace_die_notifier); - ret =0 ; + +return 0 ; out_free_cpumask:free_cpumask_var (tracing_reader_cpumask);
Signature · 1 line
1.6.1
Commit-ID: 2fc1dfbe17e7705c55b7a99da995fa565e26f151 Gitweb: http://git.kernel.org/tip/2fc1dfbe17e7705c55b7a99da995fa565e26f151 Author: Frederic Weisbecker <[email protected]> AuthorDate: Mon, 16 Mar 2009 01:45:03 +0100 Commit: Ingo Molnar <[email protected]> CommitDate: Mon, 16 Mar 2009 09:13:18 +0100
tracing/core: fix early free of cpumasks
Impact: fix crashes when tracing cpumasks
While ring-buffer allocation, the cpumasks are allocated too, including the tracing cpumask and the per-cpu file mask handler. But these cpumasks are freed accidentally just after. Fix it.
LKML-Reference: <[email protected]>
--- kernel/trace/trace.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
kernel/trace/trace.c +2 -1
@@ -4125,7 +4125,8 @@ __init static int tracer_alloc_buffers(void) &trace_panic_notifier);register_die_notifier (&trace_die_notifier); - ret =0 ; + +return 0 ; out_free_cpumask:free_cpumask_var (tracing_reader_cpumask);
Steven Rostedt
maintainerThis never made it into 2.6.29, nor do I see it yet in mainline.
This can cause unpredictable results with ftrace. We are freeing a cpu mask that will be later used.
This is definitely stable material.
Thanks to Johannes Berg for patiently bisecting his branch with a merge of my branch to locate the patch that was missing from mainline.
He was seeing empty traces, but in reality, the changing of these masks might have more dire consequences.
-- Steve
Quoted 45 lines · Frederic Weisbecker
Commit-ID: 2fc1dfbe17e7705c55b7a99da995fa565e26f151 Gitweb: http://git.kernel.org/tip/2fc1dfbe17e7705c55b7a99da995fa565e26f151 Author: Frederic Weisbecker <[email protected]> AuthorDate: Mon, 16 Mar 2009 01:45:03 +0100 Commit: Ingo Molnar <[email protected]> CommitDate: Mon, 16 Mar 2009 09:13:18 +0100tracing/core: fix early free of cpumasks
Impact: fix crashes when tracing cpumasks
While ring-buffer allocation, the cpumasks are allocated too, including the tracing cpumask and the per-cpu file mask handler. But these cpumasks are freed accidentally just after. Fix it.
Reported-by Ingo Molnar <[email protected]>Signed-off-by Frederic Weisbecker <[email protected]>LKML-Reference: <[email protected]>
Signed-off-by Ingo Molnar <[email protected]>--- kernel/trace/trace.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)kernel/trace/trace.c +2
-2@@ -4125,7 +4125,8 @@ __init static int tracer_alloc_buffers(void) &trace_panic_notifier);register_die_notifier (&trace_die_notifier); - ret =0 ; + +return 0 ; out_free_cpumask:free_cpumask_var (tracing_reader_cpumask); --To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Quoted 4 lines · Steven Rostedt
This never made it into 2.6.29, nor do I see it yet in mainline.
This can cause unpredictable results with ftrace. We are freeing a cpu mask that will be later used.
Yes ... but CONFIG_OFFSTACK is only possible as a debug option right now. So it's far less serious of an issue, it needs 2-3 unlikely features to be combined.
The fix looks simple enough, so once the tracing tree is upstream, we can forward it to -stable.
Ingo
Steven Rostedt
maintainerQuoted 11 lines · Ingo Molnar
Quoted 4 lines · Steven Rostedt
This never made it into 2.6.29, nor do I see it yet in mainline.
This can cause unpredictable results with ftrace. We are freeing a cpu mask that will be later used.
Yes ... but
CONFIG_OFFSTACKis only possible as a debug option right now. So it's far less serious of an issue, it needs 2-3 unlikely features to be combined.
And unfortunately for Johannes, he must have had all those features configured :-/ He spent pretty much the entire day trying to figure out why ftrace was broken.
-- Steve
Quoted 6 lines
The fix looks simple enough, so once the tracing tree is upstream, we can forward it to -stable.
Ingo
Quoted 11 lines · Steven Rostedt
Quoted 8 lines · Ingo Molnar
Quoted 4 lines · Steven Rostedt
This never made it into 2.6.29, nor do I see it yet in mainline.
This can cause unpredictable results with ftrace. We are freeing a cpu mask that will be later used.
Quoted 7 lines
Quoted 3 lines
Yes ... but
CONFIG_OFFSTACKis only possible as a debug option right now. So it's far less serious of an issue, it needs 2-3 unlikely features to be combined.And unfortunately for Johannes, he must have had all those features configured :-/ He spent pretty much the entire day trying to figure out why ftrace was broken.
Okay - will forward the fix to -stable once it's upstream.
Ingo