lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Sun, 11 Oct 2020 00:28:00 +0900
From:   Masami Hiramatsu <mhiramat@...nel.org>
To:     Steven Rostedt <rostedt@...dmis.org>
Cc:     Tom Zanussi <zanussi@...nel.org>,
        Masami Hiramatsu <mhiramat@...nel.org>,
        linux-kernel@...r.kernel.org
Subject: [PATCH  0/1] tracing/boot: Add alloc_snapshot for instance option

Hi,

Here is a patch to add ftrace[.instance.INSTANCE].alloc_snapshot option
to allocate snapshot buffer for specific isntance. Actually, this has
been described in Documentation/trace/boottime-trace.rst but I forgot
to implement it. (Maybe I confused it with kernel.alloc_snapshot)

Anyway, it is better to have this option with currnet ftrace implementation,
because if user sets ftrace.instance.X.event.*.*.actions = "snapshot" and
ftrace.instance.X.tracer at same bootconfig, the snapshot buffer always
removed (even if the tracer is not a max-tracer).
This seems buggy, but I'm not sure the reason why.

So if someone wants to use snapshot event action with e.g. function tracer,
they must use this option. For example,

ftrace.instance.foo {
	tracer = function
	event.signal.signal_deliver {
		enable
		actions = "snapshot if sig = 7"
	}
	alloc_snapshot
}

Steve and Tom, would you know why tracing_set_tracer() removes
snapshot buffer even if the tracer is not a max-tracer?

int tracing_set_tracer(struct trace_array *tr, const char *buf)
{
...
#ifdef CONFIG_TRACER_MAX_TRACE
        had_max_tr = tr->allocated_snapshot;

        if (had_max_tr && !t->use_max_tr) {
                /*
                 * We need to make sure that the update_max_tr sees that
                 * current_trace changed to nop_trace to keep it from
                 * swapping the buffers after we resize it.
                 * The update_max_tr is called from interrupts disabled
                 * so a synchronized_sched() is sufficient.
                 */
                synchronize_rcu();
                free_snapshot(tr);
        }
#endif
}

It seems had_max_tr is true even if the previous tracer is nop and
snapshot buffer was traced by snapshot trigger action.

This actually causes a problem except for the boot time tracing,
for example,

1) boot kernel with nop tracer
2) add snapshot trigger action to an event
   (snapshot buffer is allocated here)
3) set function tracer to current tracer
   (snapshot buffer is freed)
4) run the tracer
   -> the event trigger can not take a snapshot.


Thank you,

---

Masami Hiramatsu (1):
      tracing/boot: Add ftrace.instance.*.alloc_snapshot option


 kernel/trace/trace_boot.c |    6 ++++++
 1 file changed, 6 insertions(+)

--
Masami Hiramatsu (Linaro) <mhiramat@...nel.org>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ