Commit 2f13437b authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull more tracing updates from Steven Rostedt:
 "Two fixes and one patch that was missed:

  Fixes:

   - Missing __print_hex_dump undef for processing new function in trace
     events

   - Stop WARN_ON messages when lockdown disables tracing on boot up

  Enhancement:

   - Debug option to inject trace events from userspace (for rasdaemon)"

The enhancement has its own config option and is non invasive. It's been
discussed for sever months and should have been added to my original
push, but I never pulled it into my queue.

* tag 'trace-v5.5-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
  tracing: Do not create directories if lockdown is in affect
  tracing: Introduce trace event injection
  tracing: Fix __print_hex_dump scope
parents 056df578 a356646a
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -757,6 +757,7 @@ static inline void ftrace_test_probe_##call(void) \
#undef __get_str
#undef __get_bitmask
#undef __print_array
#undef __print_hex_dump

#undef TP_printk
#define TP_printk(fmt, args...) "\"" fmt "\", "  __stringify(args)
+9 −0
Original line number Diff line number Diff line
@@ -671,6 +671,15 @@ config HIST_TRIGGERS
	  See Documentation/trace/histogram.rst.
	  If in doubt, say N.

config TRACE_EVENT_INJECT
	bool "Trace event injection"
	depends on TRACING
	help
	  Allow user-space to inject a specific trace event into the ring
	  buffer. This is mainly used for testing purpose.

	  If unsure, say N.

config MMIOTRACE_TEST
	tristate "Test module for mmiotrace"
	depends on MMIOTRACE && m
+1 −0
Original line number Diff line number Diff line
@@ -69,6 +69,7 @@ obj-$(CONFIG_EVENT_TRACING) += trace_event_perf.o
endif
obj-$(CONFIG_EVENT_TRACING) += trace_events_filter.o
obj-$(CONFIG_EVENT_TRACING) += trace_events_trigger.o
obj-$(CONFIG_TRACE_EVENT_INJECT) += trace_events_inject.o
obj-$(CONFIG_HIST_TRIGGERS) += trace_events_hist.o
obj-$(CONFIG_BPF_EVENTS) += bpf_trace.o
obj-$(CONFIG_KPROBE_EVENTS) += trace_kprobe.o
+6 −0
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@
#include <linux/trace_seq.h>
#include <linux/spinlock.h>
#include <linux/irq_work.h>
#include <linux/security.h>
#include <linux/uaccess.h>
#include <linux/hardirq.h>
#include <linux/kthread.h>	/* for self test */
@@ -5068,6 +5069,11 @@ static __init int test_ringbuffer(void)
	int cpu;
	int ret = 0;

	if (security_locked_down(LOCKDOWN_TRACEFS)) {
		pr_warning("Lockdown is enabled, skipping ring buffer tests\n");
		return 0;
	}

	pr_info("Running ring buffer tests...\n");

	buffer = ring_buffer_alloc(RB_TEST_BUFFER_SIZE, RB_FL_OVERWRITE);
+17 −0
Original line number Diff line number Diff line
@@ -1888,6 +1888,12 @@ int __init register_tracer(struct tracer *type)
		return -1;
	}

	if (security_locked_down(LOCKDOWN_TRACEFS)) {
		pr_warning("Can not register tracer %s due to lockdown\n",
			   type->name);
		return -EPERM;
	}

	mutex_lock(&trace_types_lock);

	tracing_selftest_running = true;
@@ -8789,6 +8795,11 @@ struct dentry *tracing_init_dentry(void)
{
	struct trace_array *tr = &global_trace;

	if (security_locked_down(LOCKDOWN_TRACEFS)) {
		pr_warning("Tracing disabled due to lockdown\n");
		return ERR_PTR(-EPERM);
	}

	/* The top level trace array uses  NULL as parent */
	if (tr->dir)
		return NULL;
@@ -9231,6 +9242,12 @@ __init static int tracer_alloc_buffers(void)
	int ring_buf_size;
	int ret = -ENOMEM;


	if (security_locked_down(LOCKDOWN_TRACEFS)) {
		pr_warning("Tracing disabled due to lockdown\n");
		return -EPERM;
	}

	/*
	 * Make sure we don't accidently add more trace options
	 * than we have bits for.
Loading