Linux Trace Kernel
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Vincent Donnefort" <vdonnefort@google.com>,
	linux-trace-kernel@vger.kernel.org
Subject: Re: [PATCH v10 15/19] tracing/remotes: selftests: Add a test for the dump_on_panic tracefs file
Date: Thu, 03 Dec 2026 19:50:30 +0000	[thread overview]
Message-ID: <sashiko-outbox-248560@kernel.org> (raw)
In-Reply-To: <20261203190007.2431041-16-vdonnefort@google.com>

Thank you for your contribution! Sashiko AI review found 3 potential
issues to consider:
- [Medium] tracing/remotes: test_dump_on_panic() omits readback and
  load/unload checks
- [Low] tracing/remotes: test_dump_on_panic() leaves dump_on_panic
  enabled on return
- [Low] tracing/remotes: TRIGGER_PANIC check panics host on falsy values
  like 0
--

commit 94782c0ade367057f5036a4435f84d17bb625ebc
Author: Vincent Donnefort <vdonnefort@google.com>

tracing/remotes: selftests: Add a test for the dump_on_panic tracefs file

This commit adds ftrace selftests for the trace remote dump_on_panic
tracefs file (for both the test remote and the hypervisor remote) and
resets dump_on_panic in setup_remote().

> diff --git a/tools/testing/selftests/ftrace/test.d/remotes/dump_on_panic.tc b/tools/testing/selftests/ftrace/test.d/remotes/dump_on_panic.tc
> new file mode 100644
> index 0000000000000..ff5ca29fb1b57
> --- /dev/null
> +++ b/tools/testing/selftests/ftrace/test.d/remotes/dump_on_panic.tc
> @@ -0,0 +1,50 @@

[ ... ]

> +test_dump_on_panic()
> +{
> +    #
> +    # Toggle when the buffer is loaded
> +    #
> +    assert_loaded
> +    echo 1 > dump_on_panic
> +    echo 0 > dump_on_panic
> +
> +    #
> +    # Toggle when the buffer is unloaded
> +    #
> +    echo 0 > tracing_on
> +    assert_unloaded
> +    echo 1 > dump_on_panic
> +    echo 0 > dump_on_panic
> +
> +    #
> +    # Load and unload buffer while dump_on_panic is enabled
> +    #
> +    echo 0 > tracing_on
> +    assert_unloaded
> +
> +    echo 1 > dump_on_panic
> +    echo 1 > tracing_on
> +    echo 0 > tracing_on

[Severity: Medium]
Should test_dump_on_panic() read back dump_on_panic and check the buffer
load state after these transitions?

None of the writes to dump_on_panic are read back, unlike dmesg.tc, so
dump_on_panic_show() is never exercised and an ignored write or broken
readback would pass silently.  The unloaded-toggle block also does not
call assert_unloaded after enabling dump_on_panic.

In the third block, the leading echo 0 > tracing_on and assert_unloaded
repeat the previous block while dump_on_panic is still 0, and the
subsequent tracing_on toggle omits assert_loaded and assert_unloaded.

Because trace_remote_try_unload() returns void when remote->nr_readers is
non-zero rather than failing the write, a regression that pins a reader
and blocks unloading while dump_on_panic is enabled would silently pass.

> +
> +    [ -z "$TRIGGER_PANIC" ] && return

[Severity: Low]
Does this early return leave dump_on_panic enabled on the remote after
the test finishes?

Neither finish_system() nor the hypervisor wrapper resets dump_on_panic,
and disabling tracing_on leaves remote->panic_on set to true.  Any later
trace_remote_load() on that remote will allocate panic_iter and register
panic_notifier unless dump_on_panic is reset to 0 before returning.

> +
> +    echo 1 > tracing_on
> +
> +    for i in $(seq 1 32); do
> +        echo $i > write_event
> +    done
> +
> +    echo c > /proc/sysrq-trigger

[Severity: Low]
Can setting TRIGGER_PANIC=0 (or another non-empty falsy value like false
or no) accidentally crash the host kernel here?

Because -z only tests for an empty string, any non-empty value bypasses
the return and runs echo c > /proc/sysrq-trigger.  Checking for an
explicit opt-in such as [ "$TRIGGER_PANIC" != "1" ] (as ftracetest does
for KTAP) would avoid accidental panics.

The commit message also does not mention the TRIGGER_PANIC environment
variable or this sysrq-trigger path.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261203190007.2431041-1-vdonnefort@google.com?part=15

  reply	other threads:[~2026-12-03 19:50 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03 18:59 [PATCH v10 00/19] tracing/remotes: Add printk, dump_on_panic and boot parameters Vincent Donnefort
2026-12-03 18:59 ` [PATCH v10 01/19] tracing/remotes: Gate tracefs files opening on trace remote registration Vincent Donnefort
2026-12-03 19:20   ` sashiko-bot
2026-12-03 18:59 ` [PATCH v10 02/19] tracing/remotes: Release tracefs,eventfs on registration failure Vincent Donnefort
2026-12-03 19:24   ` sashiko-bot
2026-12-03 18:59 ` [PATCH v10 03/19] tracing/remotes: Use kstrtobool for boolean tracefs files Vincent Donnefort
2026-12-03 18:59 ` [PATCH v10 04/19] tracing/remotes: Initialise pos in trace_start() Vincent Donnefort
2026-12-03 19:18   ` sashiko-bot
2026-12-03 18:59 ` [PATCH v10 05/19] tracing/remotes: Annotate remote shared fields with READ_ONCE/WRITE_ONCE Vincent Donnefort
2026-12-03 19:19   ` sashiko-bot
2026-12-03 18:59 ` [PATCH v10 06/19] tracing/remotes: Use a single per-remote polling work Vincent Donnefort
2026-12-03 18:59 ` [PATCH v10 07/19] tracing/simple_ring_buffer: Add support for compressed length Vincent Donnefort
2026-12-03 18:59 ` [PATCH v10 08/19] tracing/remotes: Add dmesg tracefs file Vincent Donnefort
2026-12-03 19:43   ` sashiko-bot
2026-12-03 18:59 ` [PATCH v10 09/19] tracing/remotes: selftests: Add a test for the " Vincent Donnefort
2026-12-03 19:39   ` sashiko-bot
2026-12-03 18:59 ` [PATCH v10 10/19] tracing/remotes: selftests: Prefix hypervisor folder Vincent Donnefort
2026-12-03 18:59 ` [PATCH v10 11/19] ring-buffer: Use panic-friendly locking in ring_buffer_iter interface Vincent Donnefort
2026-12-03 19:38   ` sashiko-bot
2026-12-03 19:00 ` [PATCH v10 12/19] ring-buffer: Add kerneldoc for ring_buffer_poll_remote Vincent Donnefort
2026-12-03 19:00 ` [PATCH v10 13/19] tracing/remotes: Use ring_buffer_capacity() in trace_remote_has_cpu() Vincent Donnefort
2026-12-03 19:00 ` [PATCH v10 14/19] tracing/remotes: Add dump_on_panic tracefs file Vincent Donnefort
2026-12-03 19:52   ` sashiko-bot
2026-12-03 19:00 ` [PATCH v10 15/19] tracing/remotes: selftests: Add a test for the " Vincent Donnefort
2026-12-03 19:50   ` sashiko-bot [this message]
2026-12-03 19:00 ` [PATCH v10 16/19] tracing/remotes: Add poll_ms " Vincent Donnefort
2026-12-03 19:50   ` sashiko-bot
2026-12-03 19:00 ` [PATCH v10 17/19] tracing/remotes: Add trace_remote cmdline options Vincent Donnefort
2026-12-03 19:58   ` sashiko-bot
2026-12-03 19:00 ` [PATCH v10 18/19] Documentation: tracing/remotes: Add detailed tracefs layout Vincent Donnefort
2026-12-03 19:48   ` sashiko-bot
2026-12-03 19:00 ` [PATCH v10 19/19] Documentation/kernel-parameters: Add trace_remote Vincent Donnefort
2026-12-03 19:53   ` sashiko-bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-248560@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=vdonnefort@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox