* [for-linus][PATCH 0/6] tracing: Fixes for 6.1
@ 2022-11-05 20:50 Steven Rostedt
0 siblings, 0 replies; 7+ messages in thread
From: Steven Rostedt @ 2022-11-05 20:50 UTC (permalink / raw)
To: linux-kernel; +Cc: Masami Hiramatsu, Andrew Morton
Li Huafei (1):
ftrace: Fix use-after-free for dynamic ftrace_ops
Li Qiang (1):
kprobe: reverse kp->flags when arm_kprobe failed
Masami Hiramatsu (Google) (1):
tracing/fprobe: Fix to check whether fprobe is registered correctly
Rafael Mendonca (1):
fprobe: Check rethook_alloc() return in rethook initialization
Shang XiaoJing (1):
tracing: kprobe: Fix memory leak in test_gen_kprobe/kretprobe_cmd()
Steven Rostedt (Google) (1):
ring-buffer: Check for NULL cpu_buffer in ring_buffer_wake_waiters()
----
kernel/kprobes.c | 5 ++++-
kernel/trace/fprobe.c | 5 ++++-
kernel/trace/ftrace.c | 16 +++-------------
kernel/trace/kprobe_event_gen_test.c | 18 +++++++-----------
kernel/trace/ring_buffer.c | 11 +++++++++++
5 files changed, 29 insertions(+), 26 deletions(-)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [for-linus][PATCH 0/6] tracing: Fixes for 6.1
@ 2022-11-24 14:47 Steven Rostedt
2022-11-24 14:47 ` [for-linus][PATCH 1/6] tracing/hist: add in missing * in comment blocks Steven Rostedt
` (4 more replies)
0 siblings, 5 replies; 7+ messages in thread
From: Steven Rostedt @ 2022-11-24 14:47 UTC (permalink / raw)
To: linux-kernel; +Cc: Masami Hiramatsu, Andrew Morton
git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git
trace/urgent
Head SHA1: 4313e5a613049dfc1819a6dfb5f94cf2caff9452
Colin Ian King (1):
tracing/hist: add in missing * in comment blocks
Daniel Bristot de Oliveira (1):
tracing/osnoise: Fix duration type
Steven Rostedt (Google) (3):
tracing: Fix race where histograms can be called before the event
tracing: Add tracing_reset_all_online_cpus_unlocked() function
tracing: Free buffers when a used dynamic event is removed
Xiu Jianfeng (1):
tracing/user_events: Fix memory leak in user_event_create()
----
kernel/trace/trace.c | 11 ++++++++++-
kernel/trace/trace.h | 1 +
kernel/trace/trace_dynevent.c | 2 ++
kernel/trace/trace_events.c | 13 +++++++++++--
kernel/trace/trace_events_hist.c | 7 +++++--
kernel/trace/trace_events_synth.c | 2 --
kernel/trace/trace_events_user.c | 4 +++-
kernel/trace/trace_osnoise.c | 6 +++---
8 files changed, 35 insertions(+), 11 deletions(-)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [for-linus][PATCH 1/6] tracing/hist: add in missing * in comment blocks
2022-11-24 14:47 [for-linus][PATCH 0/6] tracing: Fixes for 6.1 Steven Rostedt
@ 2022-11-24 14:47 ` Steven Rostedt
2022-11-24 14:47 ` [for-linus][PATCH 2/6] tracing/user_events: Fix memory leak in user_event_create() Steven Rostedt
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Steven Rostedt @ 2022-11-24 14:47 UTC (permalink / raw)
To: linux-kernel; +Cc: Masami Hiramatsu, Andrew Morton, Colin Ian King
From: Colin Ian King <colin.i.king@gmail.com>
There are a couple of missing * in comment blocks. Fix these.
Cleans up two clang warnings:
kernel/trace/trace_events_hist.c:986: warning: bad line:
kernel/trace/trace_events_hist.c:3229: warning: bad line:
Link: https://lkml.kernel.org/r/20221020133019.1547587-1-colin.i.king@gmail.com
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
kernel/trace/trace_events_hist.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c
index 48465f7e97b4..087c19548049 100644
--- a/kernel/trace/trace_events_hist.c
+++ b/kernel/trace/trace_events_hist.c
@@ -983,7 +983,7 @@ static struct hist_field *find_any_var_ref(struct hist_trigger_data *hist_data,
* A trigger can define one or more variables. If any one of them is
* currently referenced by any other trigger, this function will
* determine that.
-
+ *
* Typically used to determine whether or not a trigger can be removed
* - if there are any references to a trigger's variables, it cannot.
*
@@ -3226,7 +3226,7 @@ static struct field_var *create_field_var(struct hist_trigger_data *hist_data,
* events. However, for convenience, users are allowed to directly
* specify an event field in an action, which will be automatically
* converted into a variable on their behalf.
-
+ *
* This function creates a field variable with the name var_name on
* the hist trigger currently being defined on the target event. If
* subsys_name and event_name are specified, this function simply
--
2.35.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [for-linus][PATCH 2/6] tracing/user_events: Fix memory leak in user_event_create()
2022-11-24 14:47 [for-linus][PATCH 0/6] tracing: Fixes for 6.1 Steven Rostedt
2022-11-24 14:47 ` [for-linus][PATCH 1/6] tracing/hist: add in missing * in comment blocks Steven Rostedt
@ 2022-11-24 14:47 ` Steven Rostedt
2022-11-24 14:47 ` [for-linus][PATCH 3/6] tracing/osnoise: Fix duration type Steven Rostedt
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Steven Rostedt @ 2022-11-24 14:47 UTC (permalink / raw)
To: linux-kernel; +Cc: Masami Hiramatsu, Andrew Morton, Xiu Jianfeng, Beau Belgrave
From: Xiu Jianfeng <xiujianfeng@huawei.com>
Before current_user_event_group(), it has allocated memory and save it
in @name, this should freed before return error.
Link: https://lkml.kernel.org/r/20221115014445.158419-1-xiujianfeng@huawei.com
Fixes: e5d271812e7a ("tracing/user_events: Move pages/locks into groups to prepare for namespaces")
Signed-off-by: Xiu Jianfeng <xiujianfeng@huawei.com>
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Acked-by: Beau Belgrave <beaub@linux.microsoft.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
kernel/trace/trace_events_user.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/kernel/trace/trace_events_user.c b/kernel/trace/trace_events_user.c
index ae78c2d53c8a..539b08ae7020 100644
--- a/kernel/trace/trace_events_user.c
+++ b/kernel/trace/trace_events_user.c
@@ -1100,8 +1100,10 @@ static int user_event_create(const char *raw_command)
group = current_user_event_group();
- if (!group)
+ if (!group) {
+ kfree(name);
return -ENOENT;
+ }
mutex_lock(&group->reg_mutex);
--
2.35.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [for-linus][PATCH 3/6] tracing/osnoise: Fix duration type
2022-11-24 14:47 [for-linus][PATCH 0/6] tracing: Fixes for 6.1 Steven Rostedt
2022-11-24 14:47 ` [for-linus][PATCH 1/6] tracing/hist: add in missing * in comment blocks Steven Rostedt
2022-11-24 14:47 ` [for-linus][PATCH 2/6] tracing/user_events: Fix memory leak in user_event_create() Steven Rostedt
@ 2022-11-24 14:47 ` Steven Rostedt
2022-11-24 14:47 ` [for-linus][PATCH 4/6] tracing: Fix race where histograms can be called before the event Steven Rostedt
2022-11-24 14:47 ` [for-linus][PATCH 5/6] tracing: Add tracing_reset_all_online_cpus_unlocked() function Steven Rostedt
4 siblings, 0 replies; 7+ messages in thread
From: Steven Rostedt @ 2022-11-24 14:47 UTC (permalink / raw)
To: linux-kernel
Cc: Masami Hiramatsu, Andrew Morton, stable,
Daniel Bristot de Oliveira, Jonathan Corbet
From: Daniel Bristot de Oliveira <bristot@kernel.org>
The duration type is a 64 long value, not an int. This was
causing some long noise to report wrong values.
Change the duration to a 64 bits value.
Link: https://lkml.kernel.org/r/a93d8a8378c7973e9c609de05826533c9e977939.1668692096.git.bristot@kernel.org
Cc: stable@vger.kernel.org
Cc: Daniel Bristot de Oliveira <bristot@kernel.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Jonathan Corbet <corbet@lwn.net>
Fixes: bce29ac9ce0b ("trace: Add osnoise tracer")
Signed-off-by: Daniel Bristot de Oliveira <bristot@kernel.org>
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
kernel/trace/trace_osnoise.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/kernel/trace/trace_osnoise.c b/kernel/trace/trace_osnoise.c
index 78d536d3ff3d..4300c5dc4e5d 100644
--- a/kernel/trace/trace_osnoise.c
+++ b/kernel/trace/trace_osnoise.c
@@ -917,7 +917,7 @@ void osnoise_trace_irq_entry(int id)
void osnoise_trace_irq_exit(int id, const char *desc)
{
struct osnoise_variables *osn_var = this_cpu_osn_var();
- int duration;
+ s64 duration;
if (!osn_var->sampling)
return;
@@ -1048,7 +1048,7 @@ static void trace_softirq_entry_callback(void *data, unsigned int vec_nr)
static void trace_softirq_exit_callback(void *data, unsigned int vec_nr)
{
struct osnoise_variables *osn_var = this_cpu_osn_var();
- int duration;
+ s64 duration;
if (!osn_var->sampling)
return;
@@ -1144,7 +1144,7 @@ thread_entry(struct osnoise_variables *osn_var, struct task_struct *t)
static void
thread_exit(struct osnoise_variables *osn_var, struct task_struct *t)
{
- int duration;
+ s64 duration;
if (!osn_var->sampling)
return;
--
2.35.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [for-linus][PATCH 4/6] tracing: Fix race where histograms can be called before the event
2022-11-24 14:47 [for-linus][PATCH 0/6] tracing: Fixes for 6.1 Steven Rostedt
` (2 preceding siblings ...)
2022-11-24 14:47 ` [for-linus][PATCH 3/6] tracing/osnoise: Fix duration type Steven Rostedt
@ 2022-11-24 14:47 ` Steven Rostedt
2022-11-24 14:47 ` [for-linus][PATCH 5/6] tracing: Add tracing_reset_all_online_cpus_unlocked() function Steven Rostedt
4 siblings, 0 replies; 7+ messages in thread
From: Steven Rostedt @ 2022-11-24 14:47 UTC (permalink / raw)
To: linux-kernel; +Cc: Masami Hiramatsu, Andrew Morton, Tom Zanussi, stable
From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
commit 94eedf3dded5 ("tracing: Fix race where eprobes can be called before
the event") fixed an issue where if an event is soft disabled, and the
trigger is being added, there's a small window where the event sees that
there's a trigger but does not see that it requires reading the event yet,
and then calls the trigger with the record == NULL.
This could be solved with adding memory barriers in the hot path, or to
make sure that all the triggers requiring a record check for NULL. The
latter was chosen.
Commit 94eedf3dded5 set the eprobe trigger handle to check for NULL, but
the same needs to be done with histograms.
Link: https://lore.kernel.org/linux-trace-kernel/20221118211809.701d40c0f8a757b0df3c025a@kernel.org/
Link: https://lore.kernel.org/linux-trace-kernel/20221123164323.03450c3a@gandalf.local.home
Cc: Tom Zanussi <zanussi@kernel.org>
Cc: stable@vger.kernel.org
Fixes: 7491e2c442781 ("tracing: Add a probe that attaches to trace events")
Reported-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
kernel/trace/trace_events_hist.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c
index 087c19548049..1c82478e8dff 100644
--- a/kernel/trace/trace_events_hist.c
+++ b/kernel/trace/trace_events_hist.c
@@ -5143,6 +5143,9 @@ static void event_hist_trigger(struct event_trigger_data *data,
void *key = NULL;
unsigned int i;
+ if (unlikely(!rbe))
+ return;
+
memset(compound_key, 0, hist_data->key_size);
for_each_hist_key_field(i, hist_data) {
--
2.35.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [for-linus][PATCH 5/6] tracing: Add tracing_reset_all_online_cpus_unlocked() function
2022-11-24 14:47 [for-linus][PATCH 0/6] tracing: Fixes for 6.1 Steven Rostedt
` (3 preceding siblings ...)
2022-11-24 14:47 ` [for-linus][PATCH 4/6] tracing: Fix race where histograms can be called before the event Steven Rostedt
@ 2022-11-24 14:47 ` Steven Rostedt
4 siblings, 0 replies; 7+ messages in thread
From: Steven Rostedt @ 2022-11-24 14:47 UTC (permalink / raw)
To: linux-kernel; +Cc: Masami Hiramatsu, Andrew Morton, Zheng Yejian
From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
Currently the tracing_reset_all_online_cpus() requires the
trace_types_lock held. But only one caller of this function actually has
that lock held before calling it, and the other just takes the lock so
that it can call it. More users of this function is needed where the lock
is not held.
Add a tracing_reset_all_online_cpus_unlocked() function for the one use
case that calls it without being held, and also add a lockdep_assert to
make sure it is held when called.
Then have tracing_reset_all_online_cpus() take the lock internally, such
that callers do not need to worry about taking it.
Link: https://lkml.kernel.org/r/20221123192741.658273220@goodmis.org
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Zheng Yejian <zhengyejian1@huawei.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
kernel/trace/trace.c | 11 ++++++++++-
kernel/trace/trace.h | 1 +
kernel/trace/trace_events.c | 2 +-
kernel/trace/trace_events_synth.c | 2 --
4 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index a7fe0e115272..5cfc95a52bc3 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -2180,10 +2180,12 @@ void tracing_reset_online_cpus(struct array_buffer *buf)
}
/* Must have trace_types_lock held */
-void tracing_reset_all_online_cpus(void)
+void tracing_reset_all_online_cpus_unlocked(void)
{
struct trace_array *tr;
+ lockdep_assert_held(&trace_types_lock);
+
list_for_each_entry(tr, &ftrace_trace_arrays, list) {
if (!tr->clear_trace)
continue;
@@ -2195,6 +2197,13 @@ void tracing_reset_all_online_cpus(void)
}
}
+void tracing_reset_all_online_cpus(void)
+{
+ mutex_lock(&trace_types_lock);
+ tracing_reset_all_online_cpus_unlocked();
+ mutex_unlock(&trace_types_lock);
+}
+
/*
* The tgid_map array maps from pid to tgid; i.e. the value stored at index i
* is the tgid last observed corresponding to pid=i.
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index 54ee5711c729..d42e24507152 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -580,6 +580,7 @@ int tracing_is_enabled(void);
void tracing_reset_online_cpus(struct array_buffer *buf);
void tracing_reset_current(int cpu);
void tracing_reset_all_online_cpus(void);
+void tracing_reset_all_online_cpus_unlocked(void);
int tracing_open_generic(struct inode *inode, struct file *filp);
int tracing_open_generic_tr(struct inode *inode, struct file *filp);
bool tracing_is_disabled(void);
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index 0356cae0cf74..78cd19e31dba 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -2972,7 +2972,7 @@ static void trace_module_remove_events(struct module *mod)
* over from this module may be passed to the new module events and
* unexpected results may occur.
*/
- tracing_reset_all_online_cpus();
+ tracing_reset_all_online_cpus_unlocked();
}
static int trace_module_notify(struct notifier_block *self,
diff --git a/kernel/trace/trace_events_synth.c b/kernel/trace/trace_events_synth.c
index 29fbfb27c2b2..c3b582d19b62 100644
--- a/kernel/trace/trace_events_synth.c
+++ b/kernel/trace/trace_events_synth.c
@@ -1425,7 +1425,6 @@ int synth_event_delete(const char *event_name)
mutex_unlock(&event_mutex);
if (mod) {
- mutex_lock(&trace_types_lock);
/*
* It is safest to reset the ring buffer if the module
* being unloaded registered any events that were
@@ -1437,7 +1436,6 @@ int synth_event_delete(const char *event_name)
* occur.
*/
tracing_reset_all_online_cpus();
- mutex_unlock(&trace_types_lock);
}
return ret;
--
2.35.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2022-11-24 14:48 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-24 14:47 [for-linus][PATCH 0/6] tracing: Fixes for 6.1 Steven Rostedt
2022-11-24 14:47 ` [for-linus][PATCH 1/6] tracing/hist: add in missing * in comment blocks Steven Rostedt
2022-11-24 14:47 ` [for-linus][PATCH 2/6] tracing/user_events: Fix memory leak in user_event_create() Steven Rostedt
2022-11-24 14:47 ` [for-linus][PATCH 3/6] tracing/osnoise: Fix duration type Steven Rostedt
2022-11-24 14:47 ` [for-linus][PATCH 4/6] tracing: Fix race where histograms can be called before the event Steven Rostedt
2022-11-24 14:47 ` [for-linus][PATCH 5/6] tracing: Add tracing_reset_all_online_cpus_unlocked() function Steven Rostedt
-- strict thread matches above, loose matches on Subject: below --
2022-11-05 20:50 [for-linus][PATCH 0/6] tracing: Fixes for 6.1 Steven Rostedt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox