From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796312166; b=jDcQmq1L8h6zZgd5linwj6WYvQGUVItP4ERJlvVBy4In+ia4/TClMPfq5kMK1KRU8bqV NFlTfSO0fkf2bDvi8gZb7+2T5CemnoAon4lCYUnETtw59H0w91VNNHA/oczuA8N8iEpHT aXsEbp368y/uJml0ypGlS0D3SNuCnyU4bwaAv8YfHXZ4ZWaNTgFGDz3DCBLBOmy2b2Tp3 zbBO+45PiaR/798/8dRUSbHUI+WMhmIDNMeyMNtpC/OlKYcQY4XtRPvu9aaomOYc3d+wY bZSPdbb0ZUMY+B8U8JdcNaOHjkYKbQYM69DVFocN82i/KWTmhAvrnj6JjO4HCOZOY7Q== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796312166; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=UriS/Lu73Bto7cpVEACXQgiExojtkfQnsBm3a1tCwbM=; b=A6281sOes2QpHGbGeREB/juhmoWmJTNBPzgYEik9dR1sBuTuIRwjGxyJQX7RCqTxQ2nX B7kC/upNY3bR7C94ymdW49m+h8C2ttyOeY22VpWb1SJ1wpF/5wXb5t/HXtmAKAcahWJ9l pkoSngT0tzrzUM3c3v2fM3YWHV90qlqEud9TlrIgg7hGI7kb3FRHDjL9CI72pMdLY0pIv h3tdPPVE4nrjGuseCEnk9+4N0VQdtjWvO/oPsiRhbooey2s1shCJIdKaGVEGXyzA0ky2M hXmSRj8egtXh0lbYDEoPEqo4WQN/Kzzn0Q3bfuIrQmrNyXT/0AxMljn8HQpEvYuqAFA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=iQ5vzGM8; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1C3CD606A332; Thu, 3 Dec 2026 15:36:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=iQ5vzGM8 Received: by smtp.kernel.org (Postfix) with ESMTPSA id BF7181F000C1; Thu, 3 Dec 2026 15:36:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796312165; bh=UriS/Lu73Bto7cpVEACXQgiExojtkfQnsBm3a1tCwbM=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=iQ5vzGM8lu52u5cc6d8/r88W14ywT+FxdhgBkbYBAG/qLUsTeNOnUtAycQWHwJbD7 rSABnvJP5jykJU0yJxdougd0ooCYYTo9FzEamYW9fZG0GBuqLl6+aDrT35Na6CbGCt 9ohEoRKgSVgz62+93mGThDr98+KjmgE9LKvot7QgRB652O30IQPqVOSd49oF8ks4SX j/bbERWUfoHECNRaxp+X1MuQPVSRNAuALQsl71eGzP362GDu9I+RHznFry4fPqONyW /8lTy4DZ0znGpwI72fgdcu0Ilqzk3afYNY/keoYExh6/crM5WdVrZLO3eCpCunXRRL i4GcfNfsksAvg== Subject: Re: [PATCH net-next v6 02/14] selftests: dpll: add test library and device lifecycle tests 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 Date: Thu, 03 Dec 2026 15:36:04 +0000 Message-ID: <179631216428.3146.5011387728926987110@kernel.org> In-Reply-To: <20261202153223.2725780-3-poros@redhat.com> References: <20261202153223.2725780-3-poros@redhat.com> X-sashiko-severity: Medium Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 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" 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