* [for-linus][PATCH 0/4] tracing: Fixes for 5.19
@ 2022-06-20 21:31 Steven Rostedt
2022-06-20 21:31 ` [for-linus][PATCH 1/4] tracing/kprobes: Check whether get_kretprobe() returns NULL in kretprobe_dispatcher() Steven Rostedt
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Steven Rostedt @ 2022-06-20 21:31 UTC (permalink / raw)
To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton
Gautam Menghani (1):
tracing/uprobes: Remove unwanted initialization in __trace_uprobe_create()
Masami Hiramatsu (Google) (1):
tracing/kprobes: Check whether get_kretprobe() returns NULL in kretprobe_dispatcher()
Xiang wangx (1):
tracefs: Fix syntax errors in comments
sunliming (1):
tracing: Simplify conditional compilation code in tracing_set_tracer()
----
fs/tracefs/inode.c | 2 +-
kernel/trace/trace.c | 2 --
kernel/trace/trace_kprobe.c | 11 ++++++++++-
kernel/trace/trace_uprobe.c | 1 -
4 files changed, 11 insertions(+), 5 deletions(-)
^ permalink raw reply [flat|nested] 5+ messages in thread
* [for-linus][PATCH 1/4] tracing/kprobes: Check whether get_kretprobe() returns NULL in kretprobe_dispatcher()
2022-06-20 21:31 [for-linus][PATCH 0/4] tracing: Fixes for 5.19 Steven Rostedt
@ 2022-06-20 21:31 ` Steven Rostedt
2022-06-20 21:32 ` [for-linus][PATCH 2/4] tracing: Simplify conditional compilation code in tracing_set_tracer() Steven Rostedt
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Steven Rostedt @ 2022-06-20 21:31 UTC (permalink / raw)
To: linux-kernel
Cc: Ingo Molnar, Andrew Morton, Yonghong Song, Peter Zijlstra, bpf,
Kernel Team, stable, Masami Hiramatsu (Google), Jiri Olsa
From: "Masami Hiramatsu (Google)" <mhiramat@kernel.org>
There is a small chance that get_kretprobe(ri) returns NULL in
kretprobe_dispatcher() when another CPU unregisters the kretprobe
right after __kretprobe_trampoline_handler().
To avoid this issue, kretprobe_dispatcher() checks the get_kretprobe()
return value again. And if it is NULL, it returns soon because that
kretprobe is under unregistering process.
This issue has been introduced when the kretprobe is decoupled
from the struct kretprobe_instance by commit d741bf41d7c7
("kprobes: Remove kretprobe hash"). Before that commit, the
struct kretprob_instance::rp directly points the kretprobe
and it is never be NULL.
Link: https://lkml.kernel.org/r/165366693881.797669.16926184644089588731.stgit@devnote2
Reported-by: Yonghong Song <yhs@fb.com>
Fixes: d741bf41d7c7 ("kprobes: Remove kretprobe hash")
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: bpf <bpf@vger.kernel.org>
Cc: Kernel Team <kernel-team@fb.com>
Cc: stable@vger.kernel.org
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
kernel/trace/trace_kprobe.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index 93507330462c..a245ea673715 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -1718,8 +1718,17 @@ static int
kretprobe_dispatcher(struct kretprobe_instance *ri, struct pt_regs *regs)
{
struct kretprobe *rp = get_kretprobe(ri);
- struct trace_kprobe *tk = container_of(rp, struct trace_kprobe, rp);
+ struct trace_kprobe *tk;
+
+ /*
+ * There is a small chance that get_kretprobe(ri) returns NULL when
+ * the kretprobe is unregister on another CPU between kretprobe's
+ * trampoline_handler and this function.
+ */
+ if (unlikely(!rp))
+ return 0;
+ tk = container_of(rp, struct trace_kprobe, rp);
raw_cpu_inc(*tk->nhit);
if (trace_probe_test_flag(&tk->tp, TP_FLAG_TRACE))
--
2.35.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [for-linus][PATCH 2/4] tracing: Simplify conditional compilation code in tracing_set_tracer()
2022-06-20 21:31 [for-linus][PATCH 0/4] tracing: Fixes for 5.19 Steven Rostedt
2022-06-20 21:31 ` [for-linus][PATCH 1/4] tracing/kprobes: Check whether get_kretprobe() returns NULL in kretprobe_dispatcher() Steven Rostedt
@ 2022-06-20 21:32 ` Steven Rostedt
2022-06-20 21:32 ` [for-linus][PATCH 3/4] tracefs: Fix syntax errors in comments Steven Rostedt
2022-06-20 21:32 ` [for-linus][PATCH 4/4] tracing/uprobes: Remove unwanted initialization in __trace_uprobe_create() Steven Rostedt
3 siblings, 0 replies; 5+ messages in thread
From: Steven Rostedt @ 2022-06-20 21:32 UTC (permalink / raw)
To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton, sunliming
From: sunliming <sunliming@kylinos.cn>
Two conditional compilation directives "#ifdef CONFIG_TRACER_MAX_TRACE"
are used consecutively, and no other code in between. Simplify conditional
the compilation code and only use one "#ifdef CONFIG_TRACER_MAX_TRACE".
Link: https://lkml.kernel.org/r/20220602140613.545069-1-sunliming@kylinos.cn
Signed-off-by: sunliming <sunliming@kylinos.cn>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
kernel/trace/trace.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 2c95992e2c71..a8cfac0611bc 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -6424,9 +6424,7 @@ int tracing_set_tracer(struct trace_array *tr, const char *buf)
synchronize_rcu();
free_snapshot(tr);
}
-#endif
-#ifdef CONFIG_TRACER_MAX_TRACE
if (t->use_max_tr && !had_max_tr) {
ret = tracing_alloc_snapshot_instance(tr);
if (ret < 0)
--
2.35.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [for-linus][PATCH 3/4] tracefs: Fix syntax errors in comments
2022-06-20 21:31 [for-linus][PATCH 0/4] tracing: Fixes for 5.19 Steven Rostedt
2022-06-20 21:31 ` [for-linus][PATCH 1/4] tracing/kprobes: Check whether get_kretprobe() returns NULL in kretprobe_dispatcher() Steven Rostedt
2022-06-20 21:32 ` [for-linus][PATCH 2/4] tracing: Simplify conditional compilation code in tracing_set_tracer() Steven Rostedt
@ 2022-06-20 21:32 ` Steven Rostedt
2022-06-20 21:32 ` [for-linus][PATCH 4/4] tracing/uprobes: Remove unwanted initialization in __trace_uprobe_create() Steven Rostedt
3 siblings, 0 replies; 5+ messages in thread
From: Steven Rostedt @ 2022-06-20 21:32 UTC (permalink / raw)
To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton, Xiang wangx
From: Xiang wangx <wangxiang@cdjrlc.com>
Delete the redundant word 'to'.
Link: https://lkml.kernel.org/r/20220605092729.13010-1-wangxiang@cdjrlc.com
Signed-off-by: Xiang wangx <wangxiang@cdjrlc.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
fs/tracefs/inode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/tracefs/inode.c b/fs/tracefs/inode.c
index de7252715b12..81d26abf486f 100644
--- a/fs/tracefs/inode.c
+++ b/fs/tracefs/inode.c
@@ -553,7 +553,7 @@ struct dentry *tracefs_create_dir(const char *name, struct dentry *parent)
*
* Only one instances directory is allowed.
*
- * The instances directory is special as it allows for mkdir and rmdir to
+ * The instances directory is special as it allows for mkdir and rmdir
* to be done by userspace. When a mkdir or rmdir is performed, the inode
* locks are released and the methods passed in (@mkdir and @rmdir) are
* called without locks and with the name of the directory being created
--
2.35.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [for-linus][PATCH 4/4] tracing/uprobes: Remove unwanted initialization in __trace_uprobe_create()
2022-06-20 21:31 [for-linus][PATCH 0/4] tracing: Fixes for 5.19 Steven Rostedt
` (2 preceding siblings ...)
2022-06-20 21:32 ` [for-linus][PATCH 3/4] tracefs: Fix syntax errors in comments Steven Rostedt
@ 2022-06-20 21:32 ` Steven Rostedt
3 siblings, 0 replies; 5+ messages in thread
From: Steven Rostedt @ 2022-06-20 21:32 UTC (permalink / raw)
To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton, Gautam Menghani
From: Gautam Menghani <gautammenghani201@gmail.com>
Remove the unwanted initialization of variable 'ret'. This fixes the clang
scan warning: Value stored to 'ret' is never read [deadcode.DeadStores]
Link: https://lkml.kernel.org/r/20220612144232.145209-1-gautammenghani201@gmail.com
Signed-off-by: Gautam Menghani <gautammenghani201@gmail.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
kernel/trace/trace_uprobe.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c
index 9711589273cd..c3dc4f859a6b 100644
--- a/kernel/trace/trace_uprobe.c
+++ b/kernel/trace/trace_uprobe.c
@@ -546,7 +546,6 @@ static int __trace_uprobe_create(int argc, const char **argv)
bool is_return = false;
int i, ret;
- ret = 0;
ref_ctr_offset = 0;
switch (argv[0][0]) {
--
2.35.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-06-20 21:32 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-20 21:31 [for-linus][PATCH 0/4] tracing: Fixes for 5.19 Steven Rostedt
2022-06-20 21:31 ` [for-linus][PATCH 1/4] tracing/kprobes: Check whether get_kretprobe() returns NULL in kretprobe_dispatcher() Steven Rostedt
2022-06-20 21:32 ` [for-linus][PATCH 2/4] tracing: Simplify conditional compilation code in tracing_set_tracer() Steven Rostedt
2022-06-20 21:32 ` [for-linus][PATCH 3/4] tracefs: Fix syntax errors in comments Steven Rostedt
2022-06-20 21:32 ` [for-linus][PATCH 4/4] tracing/uprobes: Remove unwanted initialization in __trace_uprobe_create() Steven Rostedt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox