From: netdev-bot+sashiko@kernel.org
To: poros@redhat.com
Cc: netdev@vger.kernel.org, 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, ivecera@redhat.com, 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 v6 02/14] selftests: dpll: add test library and device lifecycle tests
Date: Thu, 03 Dec 2026 15:36:04 +0000 [thread overview]
Message-ID: <179631216428.3146.5011387728926987110@kernel.org> (raw)
In-Reply-To: <20261202153223.2725780-3-poros@redhat.com>
Thank you for your contribution! Sashiko AI review found 3 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 2
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] After a device has been removed, its name stays recorded in
DPLLSIM_CREATED_NAME, and the exit cleanup deletes whatever directory…
- [Low] The header of tools/testing/selftests/drivers/dpll/dpll_stress.sh
(lines 4-5) says "Uses dpllsim to put the DPLL core under load, the…
- [Low] dpll_lib_run_dir() in
tools/testing/selftests/drivers/dpll/dpll_lib.sh (lines 70-72) makes…
--
selftests: dpll: add test library and device lifecycle tests
This adds a shell library for DPLL selftests. It wraps the iproute2 dpll
tool and the dpllsim configfs interface, and the patch adds two scripts
built on it. dpll_basic.sh checks the mandatory netlink attributes of a
hardware or simulated device. dpll_stress.sh drives dpllsim devices
through repeated create/delete and register/unregister cycles.
> 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..0b75220d7d0bc
> --- /dev/null
> +++ b/tools/testing/selftests/drivers/dpll/dpll_lib.sh
> @@ -0,0 +1,448 @@
[ ... ]
> +# Create DPLL_RUN_DIR private when it is missing and make an existing
> +# one private too, whatever the umask, others that can write to it
> +# could plant a symlink in place of the lock file. Skip when that fails.
> +dpll_lib_run_dir()
> +{
> + mkdir -m 0700 "$DPLL_RUN_DIR" 2>/dev/null
> + if ! [ -d "$DPLL_RUN_DIR" ] ||
> + ! chmod 0700 "$DPLL_RUN_DIR" 2>/dev/null; then
> + echo "SKIP: cannot set up $DPLL_RUN_DIR"
> + exit "$ksft_skip"
> + fi
> +}
> +
> +dpll_lib_lock()
> +{
> + if ! command -v flock &> /dev/null; then
> + echo "SKIP: flock not found"
> + exit "$ksft_skip"
> + fi
> + dpll_lib_run_dir
> + # A redirection that fails makes exec return non-zero here, bash
> + # exits the shell for it only in POSIX mode.
> + if ! { exec {DPLL_LOCK_FD}> "$DPLL_LOCK_FILE"; } 2>/dev/null; then
[Severity: Low]
Does dpll_lib_run_dir() fully provide the protection the commit message
describes?
"Its directory is made private whatever the umask, for the same reason."
mkdir -m 0700 sets the mode atomically only when it creates the directory.
If /run/dpll-selftest already exists, the code falls through to [ -d ] and
chmod 0700. Both of those follow symlinks, and neither checks the owner.
If the existing directory belongs to a non-root user, chmod 0700 leaves
that owner with write access. The owner can then replace lock with a
symlink, and the truncating redirection in dpll_lib_lock() opens it as
root and truncates the target.
If /run/dpll-selftest is itself a symlink to a directory, chmod changes
the mode of the target, and the lock file is opened inside it.
/run is normally root:root 0755, so only a privileged process could set
this up.
Would a check such as [ ! -L "$DPLL_RUN_DIR" ] && [ -O "$DPLL_RUN_DIR" ],
plus opening the lock file with >> or <> instead of >, close this? The
code is the same at the end of the series, where this directory also
holds the ref_tracker snapshot files.
> + echo "SKIP: cannot open $DPLL_LOCK_FILE"
> + exit "$ksft_skip"
> + fi
[ ... ]
> +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
> +
> + if ! mkdir "$dev_path" 2>/dev/null; then
> + return 1
> + fi
[ ... ]
> + DPLLSIM_CREATED_NAME=$name
> + if ! echo "$clock_id" 2>/dev/null > "$dev_path/clock_id"; then
> + rmdir "$dev_path" 2>/dev/null && DPLLSIM_CREATED_NAME=""
> + return 1
> + fi
> +}
[ ... ]
> +dpllsim_delete_device()
> +{
> + local dev_path="$DPLLSIM_CFG/$1"
> + local ret=0
> +
> + [ -d "$dev_path" ] || return 0
> +
> + dpllsim_undeploy "$1" || ret=1
> + rmdir "$dev_path" || ret=1
> +
> + return "$ret"
> +}
[Severity: Medium]
Is DPLLSIM_CREATED_NAME left stale once the device it names is gone?
dpllsim_delete_device() removes the directory but leaves the record
alone. dpllsim_create_device() only clears it on the failed clock_id
write path.
None of the callers clear it after a successful delete either:
test_rapid_create_delete() and test_deploy_cycle() only call
untrack_device "$name".
create_stress_device() deletes on a deploy failure and returns.
dpllsim_setup_standard_device() deletes on a deploy or netlink wait
failure and returns 1.
The early returns in dpllsim_create_device() (the [ -e ] check and a
failed mkdir) also leave the previous, already deleted name in place.
Both cleanup() handlers then run:
tools/testing/selftests/drivers/dpll/dpll_stress.sh:cleanup() {
...
if [ -n "$DPLLSIM_CREATED_NAME" ]; then
dpllsim_delete_device "$DPLLSIM_CREATED_NAME" ||
log_info "cannot delete device $DPLLSIM_CREATED_NAME"
fi
...
}
dpll_basic.sh has the same lines. dpllsim_delete_device() checks only
[ -d ] before it writes 0 to live and calls rmdir.
After test_rapid_create_delete() ends, the record names the last
"st<clock-id>" device for the rest of the run. Suppose something outside
this run creates a dpllsim item with that name before exit. Would
cleanup() then undeploy and remove it? The lock file only keeps out
other dpll selftest runs. This looks the same at the end of the series,
where more tests run between the first test and the cleanup at exit.
The commit message says:
"A device name is recorded only once its directory exists, so that the
cleanup cannot remove a directory another user created in between."
The cleanup comment also says "a double delete of a tracked one is
harmless". Both seem to hold only while the directory still belongs to
this run.
Could dpllsim_delete_device() clear DPLLSIM_CREATED_NAME when it removes
that name, or could the callers clear it after a successful delete?
> 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 @@
> +#!/bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +#
> +# DPLL subsystem stress test. Uses dpllsim to put the DPLL core under
> +# load, the tests below say what each of them exercises.
[Severity: Low]
This isn't a bug, but neither test has the description this header
points to. test_rapid_create_delete() has no comment. The only comment
in test_deploy_cycle() explains why the busywait timeouts cannot add up,
not what the test exercises.
The same holds at the end of the series for test_rapid_create_delete,
test_pin_state_flooding and test_many_devices.
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261202153223.2725780-1-poros%40redhat.com
next prev parent reply other threads:[~2026-12-03 15:36 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 15:32 [PATCH net-next v6 00/14] dpll: add a simulated DPLL device driver Petr Oros
2026-12-02 15:32 ` [PATCH net-next v6 01/14] dpll: dpllsim: Add " Petr Oros
2026-12-02 15:32 ` [PATCH net-next v6 02/14] selftests: dpll: add test library and device lifecycle tests Petr Oros
2026-12-03 15:36 ` netdev-bot+sashiko [this message]
2026-12-02 15:32 ` [PATCH net-next v6 03/14] dpll: dpllsim: Add configurable pins Petr Oros
2026-12-03 15:36 ` netdev-bot+sashiko
2026-12-02 15:32 ` [PATCH net-next v6 04/14] selftests: dpll: add pin enumeration and property tests Petr Oros
2026-12-02 15:32 ` [PATCH net-next v6 05/14] dpll: dpllsim: Add support to set input pin state Petr Oros
2026-12-02 15:32 ` [PATCH net-next v6 06/14] selftests: dpll: add pin state tests Petr Oros
2026-12-03 15:36 ` netdev-bot+sashiko
2026-12-02 15:32 ` [PATCH net-next v6 07/14] dpll: dpllsim: Add support to get/set priority on input pins Petr Oros
2026-12-02 15:32 ` [PATCH net-next v6 08/14] selftests: dpll: add pin priority test Petr Oros
2026-12-03 15:36 ` netdev-bot+sashiko
2026-12-02 15:32 ` [PATCH net-next v6 09/14] dpll: dpllsim: Add support to set frequency on pins Petr Oros
2026-12-02 15:32 ` [PATCH net-next v6 10/14] selftests: dpll: add pin frequency test Petr Oros
2026-12-03 15:36 ` netdev-bot+sashiko
2026-12-02 15:32 ` [PATCH net-next v6 11/14] dpll: dpllsim: Add support to adjust phase Petr Oros
2026-12-02 15:32 ` [PATCH net-next v6 12/14] selftests: dpll: add pin phase adjust test Petr Oros
2026-12-02 15:32 ` [PATCH net-next v6 13/14] selftests: dpll: add concurrency stress tests Petr Oros
2026-12-02 15:32 ` [PATCH net-next v6 14/14] selftests: dpll: add reference leak tests Petr Oros
2026-12-03 15:36 ` 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=179631216428.3146.5011387728926987110@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@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