History

Merge tag 'trace-v5.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace

Pull tracing fixes from Steven Rostedt: - Check for NULL in kretprobe_dispatcher() NULL can now be passed in, make sure it can handle it - Clean up unneeded #endif #ifdef of the same preprocessor check in the middle of the block. - Comment clean up - Remove unneeded initialization of the "ret" variable in __trace_uprobe_create() * tag 'trace-v5.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace: tracing/uprobes: Remove unwanted initialization in __trace_uprobe_create() tracefs: Fix syntax errors in comments tracing: Simplify conditional compilation code in tracing_set_tracer() tracing/kprobes: Check whether get_kretprobe() returns NULL in kretprobe_dispatcher()

Linus Torvalds committed 4 years ago

Commit fa1796a2 parents 16e4bce 12c3e0c4 files · +11 −5Browse files

Unified · Split

4 files
  1. fs/tracefs/inode.c +1 −1
  2. kernel/trace/trace.c +0 −2
  3. kernel/trace/trace_kprobe.c +10 −1
  4. kernel/trace/trace_uprobe.c +0 −1
fs/tracefs/inode.c+1−1
@@ -553,7 +553,7 @@ struct dentry *tracefs_create_dir(const char *name, struct dentry *parent) · 552 unmodified lines
553553 *
554554 * Only one instances directory is allowed.
555555 *
556− * The instances directory is special as it allows for mkdir and rmdir to
556+ * The instances directory is special as it allows for mkdir and rmdir
557557 * to be done by userspace. When a mkdir or rmdir is performed, the inode
558558 * locks are released and the methods passed in (@mkdir and @rmdir) are
559559 * called without locks and with the name of the directory being created
kernel/trace/trace.c+0−2
@@ -6424,9 +6424,7 @@ int tracing_set_tracer(struct trace_array *tr, const char *buf) · 6423 unmodified lines
64246424 synchronize_rcu();
64256425 free_snapshot(tr);
64266426 }
6427−#endif
64286427
6429−#ifdef CONFIG_TRACER_MAX_TRACE
64306428 if (t->use_max_tr && !had_max_tr) {
64316429 ret = tracing_alloc_snapshot_instance(tr);
64326430 if (ret < 0)
kernel/trace/trace_kprobe.c+10−1
@@ -1718,8 +1718,17 @@ static int · 1717 unmodified lines
17181718 kretprobe_dispatcher(struct kretprobe_instance *ri, struct pt_regs *regs)
17191719 {
17201720 struct kretprobe *rp = get_kretprobe(ri);
1721− struct trace_kprobe *tk = container_of(rp, struct trace_kprobe, rp);
1721+ struct trace_kprobe *tk;
1722+
1723+ /*
1724+ * There is a small chance that get_kretprobe(ri) returns NULL when
1725+ * the kretprobe is unregister on another CPU between kretprobe's
1726+ * trampoline_handler and this function.
1727+ */
1728+ if (unlikely(!rp))
1729+ return 0;
17221730
1731+ tk = container_of(rp, struct trace_kprobe, rp);
17231732 raw_cpu_inc(*tk->nhit);
17241733
17251734 if (trace_probe_test_flag(&tk->tp, TP_FLAG_TRACE))
kernel/trace/trace_uprobe.c+0−1
@@ -546,7 +546,6 @@ static int __trace_uprobe_create(int argc, const char **argv) · 545 unmodified lines
546546 bool is_return = false;
547547 int i, ret;
548548
549− ret = 0;
550549 ref_ctr_offset = 0;
551550
552551 switch (argv[0][0]) {