From: "Lynch, Nathan" <nathan.lynch@amd.com>
To: sashiko-reviews@lists.linux.dev
Cc: vkoul@kernel.org, Frank.Li@kernel.org, dmaengine@vger.kernel.org
Subject: Re: [PATCH 4/4] dmaengine: dmatest: Optionally make test errors fatal
Date: Tue, 28 Jul 2026 14:48:27 -0500 [thread overview]
Message-ID: <00d8a82c-2b9c-4ff0-a67e-738349d6f02e@amd.com> (raw)
In-Reply-To: <20260722163327.20F1F1F00A3A@smtp.kernel.org>
On 7/22/2026 11:33 AM, sashiko-bot@kernel.org wrote:
>> +/*
>> + * Record a test error whose details were just logged via result(). When
>> + * fatal_errors is set, panic once that many errors have accumulated in the
>> + * current run.
>> + */
>> +static void dmatest_note_error(struct dmatest_info *info)
>> +{
>> + unsigned int errors;
>> +
>> + if (!info->params.fatal_errors)
>> + return;
>> +
>> + errors = atomic_inc_return(&info->error_count);
>> + if (errors >= info->params.fatal_errors)
>> + panic("dmatest: fatal_errors=%u and %u error(s) encountered\n",
>> + info->params.fatal_errors, errors);
>
> [Severity: High]
> Can a concurrent modification of the fatal_errors parameter cause a spurious
> kernel panic here?
>
> If a user modifies the fatal_errors parameter to 0 (meaning 'never panic') via
> sysfs while test threads are executing, info->params.fatal_errors could be
> concurrently overwritten with 0 via add_threaded_test().
>
> If this happens between the initial check and the second read:
>
> CPU1 in dmatest_note_error()
> if (!info->params.fatal_errors) // reads > 0
> return;
>
> errors = atomic_inc_return(&info->error_count); // acts as a barrier
>
> CPU2 modifying sysfs
> info->params.fatal_errors = 0;
No I don't think writing to the module parameters in sysfs immediately
updates the parameters of a running test. The module parameters are
propagated to the test parameter block only in add_threaded_test(). I
think this is a false positive.
>
> CPU1 in dmatest_note_error()
> if (errors >= info->params.fatal_errors) // reads 0
>
> Will the condition errors >= 0 evaluate to true and inadvertently trigger the
> panic? Could we read info->params.fatal_errors into a local variable once to
> prevent this race?
>
>> +}
>
> --
> Sashiko AI review · https://sashiko.dev/#/patchset/20260722-dmatest-fixes-and-fatal-errors-v1-0-8287709987ea@amd.com?part=4
next prev parent reply other threads:[~2026-07-28 19:48 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-22 15:47 [PATCH 0/4] dmatest: shared channel fixes and fatal errors option Nathan Lynch via B4 Relay
2026-07-22 15:47 ` [PATCH 1/4] dmaengine: dmatest: Don't forcibly terminate channel in polled mode Nathan Lynch via B4 Relay
2026-07-22 15:57 ` sashiko-bot
2026-07-28 20:00 ` Lynch, Nathan
2026-07-22 15:47 ` [PATCH 2/4] dmaengine: dmatest: Suppress bogus failures when stopping a run Nathan Lynch via B4 Relay
2026-07-22 16:09 ` sashiko-bot
2026-07-22 15:47 ` [PATCH 3/4] dmaengine: dmatest: Terminate channel before freeing threads Nathan Lynch via B4 Relay
2026-07-22 16:23 ` sashiko-bot
2026-07-22 15:47 ` [PATCH 4/4] dmaengine: dmatest: Optionally make test errors fatal Nathan Lynch via B4 Relay
2026-07-22 16:33 ` sashiko-bot
2026-07-28 19:48 ` Lynch, Nathan [this message]
2026-07-22 19:58 ` Tycho Andersen
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=00d8a82c-2b9c-4ff0-a67e-738349d6f02e@amd.com \
--to=nathan.lynch@amd.com \
--cc=Frank.Li@kernel.org \
--cc=dmaengine@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=vkoul@kernel.org \
/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