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=1796135962; b=FconHuB5YHCewVr977KCJWEZQLJxHyN6+rh3jhCGVK8m/sBQWjxVPoPEHYBmi+AUlcRP K7Nd6bRIBN45MKTT9dBTpCui5ZBtDIrFXk7nWNEjFIZ+/M7ZqYKp1SPBAWUTjv+1JMBnz bc/Z/CnmsTpmizgncmkHLnmv0Psnl22v4qDyuP/+RMDjtCRoBgslQcPihKBxF9MSWQhKS T9W3jAo330lfhUNfOYU/jC2ctMKgSytdnfU767pKIWsEyZrwoHPRwPA1dnLFwnlDsr0Ia ODNx6Xs73P36+29kASJyqLWxJK+B32OlXIhAzy8LdIJk7r1WMIE5XQ2nlqy7+G6YiTg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796135962; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=WSsn5L9db/AjFskyas0y3VSp3uPYgGP3NerWgx6DQIQ=; b=YI4fTq/Dj2x0fJzZnGDhAcpNv2p2M62AgO+DtHX7G979UHJADINYoEiVUn5qZ/pKBDeS fn0LF3oCcZcyaMmBCCYsY/7XDszseYstf9Mdd39wRVCB0AdzF6/3X8gGMc1p4mL753ZDf tzDGwlmNt7GwCLv79esvP1c1Rj9La9COdDvdLP/NaKZfbO/BT8Ss/H0ek9GNHfxnlP4iX GVZdJ7np8KUCs5lgaZ/abfnDRamlHBZ6ON3CGY13DoM5HeAoesRRFwjWwJy/C+Rem9DxB a4uSK4OIuOMakpL1ZeHHeb2D1LViADAAdNbNsd9QQ6wQECxvCdYzhE0uVD+cucOID2g== 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=imHN0SqR; 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 A7A3B606A320 for ; Tue, 1 Dec 2026 14:39:22 +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=imHN0SqR Received: by smtp.kernel.org (Postfix) with ESMTPSA id BA6C71F00893; Tue, 1 Dec 2026 14:39:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796135961; bh=WSsn5L9db/AjFskyas0y3VSp3uPYgGP3NerWgx6DQIQ=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=imHN0SqRzA2FMxmdsV011TMfBgbAe2o7UR04ia2v9jWmmWdX8gx6AfnuFJMBm8ms7 7bn0n8K+cvvHLhwHBYgof3UOlct0NJc31RyDsAHRUtYDmtvEoEd59jYKhMfzvnmTdi d6nP2/6TYsswz/oIfEA0RennOb5KfqZQjLVuh14y0iORk27BiiwDwcbZUChXa5c503 mGSWxIrq9a3mkNFvHLeRdLnxWg9eC/1gSNOYJ+eYjz/AtpeJHGlxKaiECM4QZCbpl5 RkuYlyoqbbc5L189ldkH4K60NPpxEhPb0Lry0K+Ax3+YC7T8hNuKFQ/R3TQo5jl5J/ EExtmlc1uJ3vw== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH 2/2] selftests: gpio: add a test for gpio-virtuser Reply-To: sashiko-reviews@lists.linux.dev To: "Lin Tzu Yang" Cc: linux-gpio@vger.kernel.org In-Reply-To: <20261201142703.900902-3-rongh7426@gmail.com> References: <20261201142703.900902-1-rongh7426@gmail.com> <20261201142703.900902-3-rongh7426@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Tue, 01 Dec 2026 14:39:21 +0000 X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [Medium] selftests: gpio: test 1.1 fails due to dev_name mismatch in gpio-virtuser - [Medium] selftests: gpio: test 2.3 triggers 1-byte OOB write in key_show() -- commit b7b1a25a7e497e2091e3d44b29aedb3593d4949c Author: Lin Tzu Yang selftests: gpio: add a test for gpio-virtuser This commit adds a selftest script for the gpio-virtuser driver using a gpio-sim chip as the provider to exercise configfs and debugfs interfaces. > diff --git a/tools/testing/selftests/gpio/gpio-virtuser.sh b/tools/testin= g/selftests/gpio/gpio-virtuser.sh > new file mode 100755 > index 0000000000000..f5993904d302c > --- /dev/null > +++ b/tools/testing/selftests/gpio/gpio-virtuser.sh > @@ -0,0 +1,420 @@ [ ... ] > +echo "1.1. Lookup by chip label and offset" > +vu_create_dev dev0 > +vu_add_entry dev0 foo 0 "gpio-virtuser-test" 3 > +test "$(cat "$CONFIGFS_VU_DIR/dev0/live")" =3D "0" || fail "consumer is = live before enabling" > +DEV_NAME=3D$(cat "$CONFIGFS_VU_DIR/dev0/dev_name") > +vu_enable_dev dev0 > +test "$(cat "$CONFIGFS_VU_DIR/dev0/live")" =3D "1" || fail "consumer is = not live" > +test "$(cat "$CONFIGFS_VU_DIR/dev0/dev_name")" =3D "$DEV_NAME" || \ > + fail "dev_name changed when the consumer was enabled" [Severity: Medium] Does this dev_name check depend on an unmerged fix to gpio_virtuser_device_config_dev_name_show()? In the current tree, gpio_virtuser_device_config_dev_name_show() formats the pre-activation fallback name as "gpio-sim.%d" when dev->pdev is NULL, whereas activating the device registers the platform device as "gpio-virtuser.%d": drivers/gpio/gpio-virtuser.c:gpio_virtuser_device_config_dev_name_show() { ... pdev =3D dev->pdev; if (pdev) return sprintf(page, "%s\n", dev_name(&pdev->dev)); return sprintf(page, "gpio-sim.%d\n", dev->id); } As a result, DEV_NAME is "gpio-sim.0" before vu_enable_dev and "gpio-virtuser.0" afterwards, causing test 1.1 to fail on every run. [ ... ] > +echo "2.3. A key of the maximum length reads back intact" > +# A show that writes past the page for such a key is only caught by KASA= N. > +vu_create_dev dev0 > +mkdir -p "$ENTRY_DIR" || fail "Unable to create the lookup entry" > +head -c 4095 /dev/zero | tr '\0' 'k' > "$ENTRY_DIR/key" || fail "long ke= y rejected" > +test "$(cat "$ENTRY_DIR/key" | wc -c)" -ge 4095 || fail "long key trunca= ted" > +test "$(cat "$ENTRY_DIR/key" | tr -d 'k\n' | wc -c)" =3D "0" || \ > + fail "long key read back corrupted" > +vu_remove_dev dev0 [Severity: Medium] Does reading back a 4095-byte key here trigger a 1-byte slab-out-of-bounds write in gpio_virtuser_lookup_entry_config_key_show()? drivers/gpio/gpio-virtuser.c:gpio_virtuser_lookup_entry_config_key_show() { ... return sprintf(page, "%s\n", entry->key ?: ""); } Configfs allocates a PAGE_SIZE (4096-byte on 4K-page kernels) read buffer in fill_read_buffer(), so formatting a 4095-byte key plus a newline and terminating NUL with sprintf() writes 4097 bytes and overflows the page by 1 byte unless gpio_virtuser_lookup_entry_config_key_show() is switched to sysfs_emit() first. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261201142703.9009= 02-1-rongh7426@gmail.com?part=3D2