linux/kernel/trace
Luis Chamberlain ab2d90e58a blktrace: ensure our debugfs dir exists
[ Upstream commit b431ef837e ]

We make an assumption that a debugfs directory exists, but since
this can fail ensure it exists before allowing blktrace setup to
complete. Otherwise we end up stuffing blktrace files on the debugfs
root directory. In the worst case scenario this *in theory* can create
an eventual panic *iff* in the future a similarly named file is created
prior on the debugfs root directory. This theoretical crash can happen
due to a recursive removal followed by a specific dentry removal.

This doesn't fix any known crash, however I have seen the files
go into the main debugfs root directory in cases where the debugfs
directory was not created due to other internal bugs with blktrace
now fixed.

blktrace is also completely useless without this directory, so
this ensures to userspace we only setup blktrace if the kernel
can stuff files where they are supposed to go into.

debugfs directory creations typically aren't checked for, and we have
maintainers doing sweep removals of these checks, but since we need this
check to ensure proper userspace blktrace functionality we make sure
to annotate the justification for the check.

Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-09-03 11:26:42 +02:00
..
Kconfig Stop the ad-hoc games with -Wno-maybe-initialized 2020-05-20 08:20:28 +02:00
Makefile
blktrace.c blktrace: ensure our debugfs dir exists 2020-09-03 11:26:42 +02:00
bpf_trace.c
fgraph.c
ftrace.c tracing: Use trace_sched_process_free() instead of exit() for pid tracing 2020-08-21 13:05:27 +02:00
ftrace_internal.h
power-traces.c
preemptirq_delay_test.c
ring_buffer.c ring-buffer: Zero out time extend if it is nested and not absolute 2020-06-30 15:37:10 -04:00
ring_buffer_benchmark.c
rpm-traces.c
trace.c tracing: Move pipe reference to trace array instead of current_tracer 2020-08-21 13:05:27 +02:00
trace.h tracing: Move pipe reference to trace array instead of current_tracer 2020-08-21 13:05:27 +02:00
trace_benchmark.c
trace_benchmark.h
trace_branch.c
trace_clock.c
trace_dynevent.c
trace_dynevent.h
trace_entries.h
trace_event_perf.c
trace_events.c tracing: Use trace_sched_process_free() instead of exit() for pid tracing 2020-08-21 13:05:27 +02:00
trace_events_filter.c
trace_events_filter_test.h
trace_events_hist.c
trace_events_trigger.c tracing: Fix event trigger to accept redundant spaces 2020-06-30 15:37:10 -04:00
trace_export.c
trace_functions.c
trace_functions_graph.c
trace_hwlat.c tracing/hwlat: Honor the tracing_cpumask 2020-08-21 13:05:27 +02:00
trace_irqsoff.c
trace_kdb.c
trace_kprobe.c tracing/probe: Fix bpf_task_fd_query() for kprobes and uprobes 2020-06-24 17:50:43 +02:00
trace_kprobe_selftest.c
trace_kprobe_selftest.h
trace_mmiotrace.c
trace_nop.c
trace_output.c
trace_output.h
trace_preemptirq.c
trace_printk.c
trace_probe.c tracing/probe: Fix memleak in fetch_op_data operations 2020-06-24 17:50:51 +02:00
trace_probe.h
trace_probe_tmpl.h
trace_sched_switch.c
trace_sched_wakeup.c
trace_selftest.c
trace_selftest_dynamic.c
trace_seq.c
trace_stack.c
trace_stat.c
trace_stat.h
trace_syscalls.c
trace_uprobe.c tracing/probe: Fix bpf_task_fd_query() for kprobes and uprobes 2020-06-24 17:50:43 +02:00
tracing_map.c
tracing_map.h