From: netdev-bot+sashiko@kernel.org
To: poros@redhat.com
Cc: netdev@vger.kernel.org, ivecera@redhat.com, jiri@nvidia.com,
corbet@lwn.net, skhan@linuxfoundation.org, shuah@kernel.org,
rdunlap@infradead.org, jani.nikula@intel.com,
vadim.fedorenko@linux.dev, arkadiusz.kubalewski@intel.com,
jiri@resnulli.us, andrew+netdev@lunn.ch, davem@davemloft.net,
edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org
Subject: Re: [PATCH net-next v5 02/14] selftests: dpll: add test library and device lifecycle tests
Date: Sun, 29 Nov 2026 10:38:45 +0000 [thread overview]
Message-ID: <179594872531.3146.15166593667750636013@kernel.org> (raw)
In-Reply-To: <20261125090522.3777494-3-poros@redhat.com>
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] Signal race in dpllsim_create_device()
(tools/testing/selftests/drivers/dpll/dpll_lib.sh) that can make a run…
--
selftests: dpll: add test library and device lifecycle tests
This adds a shell library for the DPLL selftests. It wraps the iproute2
dpll tool and the dpllsim configfs interface. It also adds two scripts:
dpll_basic.sh checks the mandatory device attributes over netlink, and
dpll_stress.sh repeatedly creates, deploys and deletes dpllsim devices.
> diff --git a/tools/testing/selftests/drivers/dpll/dpll_lib.sh b/tools/testing/selftests/drivers/dpll/dpll_lib.sh
> new file mode 100644
> index 0000000000000..467527a4343af
> --- /dev/null
> +++ b/tools/testing/selftests/drivers/dpll/dpll_lib.sh
> @@ -0,0 +1,446 @@
[ ... ]
> +dpllsim_create_device()
> +{
> + local name=$1
> + local clock_id=$2
> + local dev_path="$DPLLSIM_CFG/$name"
> +
> + # A directory of that name was left behind by something else and
> + # must never be recorded as a device of this run.
> + [ -e "$dev_path" ] && return 1
> +
> + # Record the name before the directory exists, so that a cleanup
> + # run by a signal between the two still finds it.
> + DPLLSIM_CREATED_NAME=$name
> + if ! mkdir "$dev_path" 2>/dev/null; then
> + DPLLSIM_CREATED_NAME=""
> + return 1
> + fi
[Severity: Low]
Can the cleanup handler end up deleting a dpllsim device that this run
did not create?
The flock in dpll_lib_lock() only serializes the scripts in this
directory. Other users of the shared dpllsim configfs directory are not
serialized by it. Examples are a root user working by hand, or a run in
a container that has its own /run but shares the global configfs.
Suppose such a user creates a directory with the same name between the
[ -e "$dev_path" ] check and the mkdir. The mkdir then fails with EEXIST.
DPLLSIM_CREATED_NAME still holds the name in two windows:
- between the assignment and the mkdir
- after the failed mkdir returns, before DPLLSIM_CREATED_NAME=""
bash runs a pending INT or TERM trap as soon as the foreground command
finishes. A harness timeout or Ctrl-C in either window runs the trap
below, and the trap exits before the reset happens:
trap 'trap "" INT TERM; trap - EXIT; cleanup; exit 1' INT TERM
[ ... ]
> diff --git a/tools/testing/selftests/drivers/dpll/dpll_stress.sh b/tools/testing/selftests/drivers/dpll/dpll_stress.sh
> new file mode 100755
> index 0000000000000..2c60ac9faefda
> --- /dev/null
> +++ b/tools/testing/selftests/drivers/dpll/dpll_stress.sh
> @@ -0,0 +1,201 @@
[ ... ]
> +cleanup()
> +{
> + # A second signal must not abort the teardown half way.
> + trap '' INT TERM
> +
> + local dev
> +
> + for dev in "${CREATED_DEVICES[@]}"; do
> + dpllsim_delete_device "$dev" ||
> + log_info "cannot delete device $dev"
> + done
> + # The device whose creation a signal interrupted is recorded by the
> + # library alone, a double delete of a tracked one is harmless.
> + if [ -n "$DPLLSIM_CREATED_NAME" ]; then
> + dpllsim_delete_device "$DPLLSIM_CREATED_NAME" ||
> + log_info "cannot delete device $DPLLSIM_CREATED_NAME"
> + fi
> + dpll_lib_cleanup
> +}
[Severity: Low]
In that case, dpllsim_delete_device() here finds the other user's
directory and writes 0 to its live attribute. That unregisters the device
from the DPLL core, and the directory is then removed with rmdir.
cleanup() in dpll_basic.sh does the same, reached through
dpllsim_setup_standard_device()->dpllsim_create_device().
The v4 changelog says a directory that existed before must never be
recorded as a device of the run. Doesn't recording the name before an
mkdir that can fail leave a window where the record points at a directory
this run did not create?
The window is narrow. It needs another root user to create the exact
std/st/cycle name that was just picked, and a signal at the same moment.
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261125090522.3777494-1-poros%40redhat.com
next prev parent reply other threads:[~2026-11-29 10:38 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 9:05 [PATCH net-next v5 00/14] dpll: add a simulated DPLL device driver Petr Oros
2026-11-25 9:05 ` [PATCH net-next v5 01/14] dpll: dpllsim: Add " Petr Oros
2026-11-29 10:38 ` netdev-bot+sashiko
2026-11-25 9:05 ` [PATCH net-next v5 02/14] selftests: dpll: add test library and device lifecycle tests Petr Oros
2026-11-29 10:38 ` netdev-bot+sashiko [this message]
2026-11-25 9:05 ` [PATCH net-next v5 03/14] dpll: dpllsim: Add configurable pins Petr Oros
2026-11-29 10:38 ` netdev-bot+sashiko
2026-11-25 9:05 ` [PATCH net-next v5 04/14] selftests: dpll: add pin enumeration and property tests Petr Oros
2026-11-29 10:38 ` netdev-bot+sashiko
2026-11-25 9:05 ` [PATCH net-next v5 05/14] dpll: dpllsim: Add support to set input pin state Petr Oros
2026-11-25 9:05 ` [PATCH net-next v5 06/14] selftests: dpll: add pin state tests Petr Oros
2026-11-27 13:39 ` Ivan Vecera
2026-11-29 10:38 ` netdev-bot+sashiko
2026-11-25 9:05 ` [PATCH net-next v5 07/14] dpll: dpllsim: Add support to get/set priority on input pins Petr Oros
2026-11-27 13:39 ` Ivan Vecera
2026-11-25 9:05 ` [PATCH net-next v5 08/14] selftests: dpll: add pin priority test Petr Oros
2026-11-27 13:40 ` Ivan Vecera
2026-11-29 10:38 ` netdev-bot+sashiko
2026-11-25 9:05 ` [PATCH net-next v5 09/14] dpll: dpllsim: Add support to set frequency on pins Petr Oros
2026-11-27 13:40 ` Ivan Vecera
2026-11-25 9:05 ` [PATCH net-next v5 10/14] selftests: dpll: add pin frequency test Petr Oros
2026-11-29 10:38 ` netdev-bot+sashiko
2026-11-25 9:05 ` [PATCH net-next v5 11/14] dpll: dpllsim: Add support to adjust phase Petr Oros
2026-11-25 9:05 ` [PATCH net-next v5 12/14] selftests: dpll: add pin phase adjust test Petr Oros
2026-11-29 10:38 ` netdev-bot+sashiko
2026-11-25 9:05 ` [PATCH net-next v5 13/14] selftests: dpll: add concurrency stress tests Petr Oros
2026-11-29 10:38 ` netdev-bot+sashiko
2026-11-25 9:05 ` [PATCH net-next v5 14/14] selftests: dpll: add reference leak tests Petr Oros
2026-11-29 10:39 ` netdev-bot+sashiko
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=179594872531.3146.15166593667750636013@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=arkadiusz.kubalewski@intel.com \
--cc=corbet@lwn.net \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=ivecera@redhat.com \
--cc=jani.nikula@intel.com \
--cc=jiri@nvidia.com \
--cc=jiri@resnulli.us \
--cc=kuba@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=poros@redhat.com \
--cc=rdunlap@infradead.org \
--cc=shuah@kernel.org \
--cc=skhan@linuxfoundation.org \
--cc=vadim.fedorenko@linux.dev \
/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