[GIT PULL] tracing: Updates for v7.3
Steven Rostedt <[email protected]>
| Newsgroups | org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
Linus,
tracing updates for v7.3:
- Expose btf_ids to trace events
In order to allow BPF programs to attach to system call trace events (which
are actually pseudo trace events built on top of raw_syscall events),
expose the BTF ID of the events. This will allow BPF programs better
precision in attaching to events.
- Use "u64" to assign to hist_field->type
Instead of using kstrdup("u64", GFP_KERNEL) to assign the hist_field->type,
just point it to "u64" instead. The hist_field->type is freed via
kfree_const().
- Replace kmalloc()/strcpy() with kstrdup() for trace_printk
Instead of having two calls to copy the module format string, just use
kstrdup().
- Use __free() in trace event histograms and triggres where possible
- Use seq_buf in trace event code instead of strcat()
Instead of calculating the size of the buffer to use and filling it with
strcat(), use the seq_buf infrastructure that takes care of making sure
not to overflow the string size.
- Reject invalid preemptirq_delay_test CPU affinity
The preempt_delay_test module can take an invalid CPU affinity mask and
create confusing output. Simply have the module reject invalid affinity
masks.
- Prevent division by zero in ftrace_ops sample module code
If the ftrace_ops sample module code receives the module parameter
nr_function_calls set to zero, it can cause a division by zero error.
- Warn when an event dereferences a parameter in TP_printk()
On boot up and module load, the trace event TP_printk() is scanned for
possible bugs. As the TP_printk() code is executed when the user reads the
"trace" file and processes the data written when the trace_event executed,
the data it reads can be literally days old. The scan currently checks for
dereferencing printk formats like "%pI6". But it does not check if the
parameters themselves have a dereference like:
TP_printk("offset %08x: value %08x",
(u32)(__entry->addr - __entry->edma->membase), __entry->value)
__entry represents the pointer to the event on the ring buffer. The
__entry->edma->membase is dereferencing a pointer on the ring buffer to
find membase, but the __entry->edma may no longer be a valid pointer.
Warn on this case too.
- Replace some strcpy() with strscpy()
- Clean up mmiotrace events to use assign_type() macro
The assign_type() macro makes sure the event type is indeed the type that
is being parsed. The mmiotrace trace was written before that macro was
created so it just simply typecasted the pointer.
Replace the typecasting with the macro.
- Have the ENUM processing to numbers only process what is added
The code that converts ENUMs to their numbers in the trace events scanned
all events to do the processing. This was true when a module was loaded
too. That is, instead of processing just the events for the module, it
processed *all* events. Even the builtin ones that were processed at boot
up.
Add a check for the event->module matching mod if it is a module before
processing it.
Please pull the latest trace-v7.3 tree, which can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git
trace-v7.3
Tag SHA1: b47dd295cb1a6acfc4263187c56a87f55775b882
Head SHA1: ae70b04ab9c7f6162a8c0fdd18a62a945c133142
David Carlier (1):
tracing: Report every TP_printk double dereference
David Laight (1):
kernel/trace/trace_printk: Use kstrdup() instead of kmalloc() and strcpy()
Markus Elfring (3):
tracing/user_events: Use seq_putc() in two functions
tracing/user_events: Replace a seq_printf() call by seq_puts() in user_seq_show()
fgraph: Use trace_seq_putc() in print_graph_return()
Masami Hiramatsu (Google) (1):
tracing/mmiotrace: Use trace_assign_type() in mmio_print_mark()
Mykyta Yatsenko (4):
bpf: Make btf_get_module_btf() and btf_relocate_id() non-static
tracing: Expose tracepoint BTF ids via tracefs
selftests/bpf: Add test for tracepoint btf_ids tracefs file
tracing: Make per-template BTF id lists file-local
Pengpeng Hou (3):
tracing: Use __free() for expr_str() buffer
tracing: Return ERR_PTR() from expr_str()
tracing: Bound histogram expression strings with seq_buf
Po-Sheng Lin (1):
tracing: Use strscpy() instead of strcpy() in trace_sched_switch
Samuel Moelius (2):
tracing: Reject invalid preemptirq_delay_test CPU affinity
samples/ftrace: Prevent division by zero when nr_function_calls is zero
Steven Rostedt (3):
tracing: Warn when an event dereferences a pointer in TP_printk()
tracing: Cleanup event_enable_trigger_parse() by using __free()
tracing: Have trace_event_update_all() only handle module that is loading
Woradorn Laodhanadhaworn (1):
tracing: Use seq_buf for string concatenation
Yu Peng (1):
tracing: Point constant hist field type to string literal
----
include/linux/btf.h | 2 +
include/linux/trace_events.h | 9 ++
include/trace/trace_events.h | 23 ++++
kernel/bpf/btf.c | 4 +-
kernel/trace/preemptirq_delay_test.c | 9 ++
kernel/trace/trace.c | 2 +-
kernel/trace/trace.h | 4 +-
kernel/trace/trace_events.c | 139 +++++++++++++++++++--
kernel/trace/trace_events_hist.c | 96 ++++++++------
kernel/trace/trace_events_trigger.c | 16 +--
kernel/trace/trace_events_user.c | 10 +-
kernel/trace/trace_functions_graph.c | 2 +-
kernel/trace/trace_mmiotrace.c | 7 +-
kernel/trace/trace_printk.c | 3 +-
kernel/trace/trace_sched_switch.c | 6 +-
kernel/trace/trace_syscalls.c | 18 +++
samples/ftrace/ftrace-ops.c | 2 +-
.../testing/selftests/bpf/prog_tests/tp_btf_ids.c | 132 +++++++++++++++++++
18 files changed, 408 insertions(+), 76 deletions(-)
create mode 100644 tools/testing/selftests/bpf/prog_tests/tp_btf_ids.c
---------------------------