Re: [PATCH 3/3] tracing/probes: Fix return value when "(fault)" is injected

From: Google
Date: Thu Jul 06 2023 - 22:51:40 EST


On Thu, 6 Jul 2023 22:20:20 -0400
Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:

> On Fri, 7 Jul 2023 11:02:10 +0900
> Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx> wrote:
>
> > /* Print type function for string type */
> > int PRINT_TYPE_FUNC_NAME(string)(struct trace_seq *s, void *data, void *ent)
> > {
> > int len = *(u32 *)data >> 16;
> >
> > if (!len)
> > trace_seq_puts(s, "(fault)");
> > else
> > ----
> >
> > In this case, what we need is to set data_loc length = 0 if ret < 0.
> >
> > Do you really need to get '"(fault)"' (with double quotation) or
> > just '(fault)' (no double quotation) is OK?
>
> ># echo 'e:myopen syscalls/sys_enter_openat file=+0($filename):ustring' >> /sys/kernel/tracing/dynamic_events
> ># trace-cmd start -e myopen
> ># trace-cmd show
> # tracer: nop
> #
> # entries-in-buffer/entries-written: 19/19 #P:4
> #
> # _-----=> irqs-off/BH-disabled
> # / _----=> need-resched
> # | / _---=> hardirq/softirq
> # || / _--=> preempt-depth
> # ||| / _-=> migrate-disable
> # |||| / delay
> # TASK-PID CPU# ||||| TIMESTAMP FUNCTION
> # | | | ||||| | |
> trace-cmd-4688 [000] ...1. 466968.015784: myopen: (syscalls.sys_enter_openat) file=(fault)
> trace-cmd-4688 [000] ...1. 466968.015816: myopen: (syscalls.sys_enter_openat) file=(fault)
> trace-cmd-4688 [000] ...1. 466968.015833: myopen: (syscalls.sys_enter_openat) file=(fault)
> trace-cmd-4688 [000] ...1. 466968.015849: myopen: (syscalls.sys_enter_openat) file=(fault)
> trace-cmd-4688 [000] ...1. 466968.015864: myopen: (syscalls.sys_enter_openat) file=(fault)
> trace-cmd-4688 [000] ...1. 466968.015879: myopen: (syscalls.sys_enter_openat) file=(fault)
>
>
> Does that answer your question? ;-)

Ah, I meant that your commit 2e9906f84fc7 ("tracing: Add "(fault)" name injection
to kernel probes") tries to make it '"(fault)"', So it makes

trace-cmd-4688 [000] ...1. 466968.015879: myopen: (syscalls.sys_enter_openat) file="(fault)"

Keeping it current '(fault)' makes easy to identify which one is failed to fetch,
but it may require user to parse both "some string" and (fault). I thought that
was the reason why you added that commit.

Thank you,

>
> -- Steve


--
Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx>