๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #24122

Re: [PATCH net-next v5 02/14] selftests: dpll: add test library and device lifecycle tests

#24122
From: netdev-bot+sashiko
Date: Sun, 29 Nov 2026 10:38
119 lines
12247 bytes
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
Technical Details
Message-ID: <179594872531.3146.15166593667750636013@kernel.org>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-373450-linux-kernel-netdev=dewy.ru
References: <20261125090522.3777494-3-poros@redhat.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-373450-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
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
Organization: Usenet Network
Message-ID: <179594872531.3146.15166593667750636013@kernel.org>
References: <20261125090522.3777494-3-poros@redhat.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1150427"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:XtqHJ3oCWt8v9Og5NLlJs0HuGXg= sha256:qsuc7XkbMOQiNVmj6KarjItVwEcTPR5f4df2r5EgIgg=
	sha1:9m2vMqQSxc+b6XFFR7rU3sOkV5M= sha256:KJc2mv4jj53FhWAKBRhYCksdKZ2GRi8LxFhiRrvZuyc=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 003D6125F98; Sun, 29 Nov 2026 13:39:13 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.4
X-Spam-Status: No, score=-3.4 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id C_l2oZ3xVtKy;
	Sun, 29 Nov 2026 13:39:09 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-373450-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 6AE37125F94; Sun, 29 Nov 2026 13:39:01 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id A56072592E; Sun, 29 Nov 2026 10:38:53 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1795948733;
	b=udhurTiW5O3JR3Ufw/BhtMIUrfEgrDymvAOfEB/Xdyrun/xEvvCPr9SsCuIAkGMgnavE
	 fvk91XofzFyi9z5ILbbCjX8rp6cYkzGauXDNUXT7o0gyPJfxR/IKfDxpCLyhaRl6kJAhE
	 Id/fexX6V3pZSJ4hxndXDYNPf47BICnW4s+1hwlL4gaHJfNXZuRTSkCLaddevdHIBZwBJ
	 ltWoM1k9wFX/+ryCVsNrgtZc/jAbRe/gyx1f3RNqyhUrpMU7+CcvngTzlNLW7bMqpYZms
	 o9u/0iGZdlJFr+xcg87T+Ii5qn/ONbnWk/sVUTYQ4WKhTFO+JvHEo52YccagRGsFU3g==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795948733;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=ggNJ98+QvgmcQtOlgCbmsQI79LuxBSqpefyFI6Z9/7M=;
	b=3h+YjMA+jUPVZNuGLmRVfpEuuXuUp5ciEiA0XBauF5ARvmsvpfruwzAsOLRXogCUtaff
	 BR5PRDPfwLbomhsvRXL59sX20SQqKWnKEp04N5MkVWnItzEAVhddHu1agRxbznztkBJCK
	 lT+yiD050GvK6p5B8GOkQuVyRr/JvNj5zKrY/SPgcaG6Vfva7lxg7ipVPaxxJcGXgGpXv
	 HTDwEaQ8gzCib6PiZSRvJ14FkJ3XyBaj0Ewk4Vkv3Xdlyi1X9tbXd565rz/yIow9qHFQ+
	 uqrjZFaEQDwjLLy9ENSnp4SzLObHUn5cGuqZeg/HmANOmHDfBtfGXz2wT2cXXC8l7KA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="Vppdo/Zu";
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 5A3CA606A336;
	Sun, 29 Nov 2026 10:38:53 +0000 (UTC)
X-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=Vppdo/Zu
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795948727;
	b=cYeqnbBGnLlcEtiMVwHM8FT97ODijQ5fM43jJsHo4n/xlvE+oYyn4QdBE8R/YzLQRqSv
	 +PlTAMQSu5YIgGSZDJlS07lU/vpkCgT+UsmVTrU5C7azI1ybuGq/Z8GkaJ0yoHxj3dg4M
	 9NEttxJ1Tu0eDV15dh3LfvvP69QBmGU3UavtoTycdg44SoLJGjI3HaH6PDp9/xu/aYLN0
	 p8bESyH12eltDQItHZYZlWFFHnBmtC39x4vX5aQogGdty1FUZrlkb1/gNmzviETy5pBb2
	 GkGaawiI6jsoqsZEiwZkYJxfPMDMlGF1hS5CblT4SY+vceZ/t2DztyPJ1HiwRXoPG7A==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795948727;
	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=ggNJ98+QvgmcQtOlgCbmsQI79LuxBSqpefyFI6Z9/7M=;
	b=GhFphtyUFrKCtG2pgmmyb/8WEtAKxo4OPF/Dy/0CUESDxzVF5OkFJvNsRYja9O3Gq86j
	 seuUJbpuNOg+aKdBzJ3+LKK4tC4u69dSblVu6LnwWCyzmRsNvpl73Jv/st+qzWtKTawKR
	 9VgQd+TVOqAWZCaq5nJrRCTIEpWPesPs+P+TZt8SE9iHrLa4Fpx3k5VeKLvG9aeelL3QT
	 SUKkoiCBnik2KbpclGijtY9q+nwb1ZuuiwuQW2cmYcj0L3j31Ecj4qU4tRWIf65SetFx3
	 4h7kLZsTOH4YFW4pTCd0UiWhtevdRMSobMh56b/HOZqzj3rCHzB1D+WxeFkxcJ2A/fg==
X-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="Vppdo/Zu";
	arc=none smtp.remote-ip=100.103.45.18
X-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 782CE606A323;
	Sun, 29 Nov 2026 10:38:47 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id BCE101F00897;
	Sun, 29 Nov 2026 10:38:45 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1795948726;
	bh=ggNJ98+QvgmcQtOlgCbmsQI79LuxBSqpefyFI6Z9/7M=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=Vppdo/ZuEfV7bUQ6sG/3D3DwPqpVnZSjPiMeWI6J0hiJSIXdtO28cx6ykAaZEQLam
	 /+4A45pPZWmw2g2Bj9WBvawG1OwUZ2hXA2QLD5YemanOQYcNCmooh2yjKTmy4vwcD5
	 BMsZ27syS2H11PTvURskPYe66G0tKudKh5IEo4pfIXiPR13rlzIBPMs6PTO17l91BF
	 t6tB/AxlXWsObhQl7E+nh9LH2tDqFaVMxAuthjR1FXQLtWtw/HwTz91a/UKazZ6bju
	 /SJOn/KspIz0Hb54EZH1rR8Eur3nH7zfsb4kcET++jlUToeZnS7THYhhTuqkSKpvNs
	 T8kwLT3UalXVQ==
X-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
X-In-Reply-To: <20261125090522.3777494-3-poros@redhat.com>
X-sashiko-severity: Low
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list