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=1796296607; b=pfvvDq37RNfyzUQGAR7ROAoK5nWxLJi83nNPbBEzaDUm6leRJpX8n0z5mMmIXml09mEj zSKsCjBtBsOWHjtfI5eMJzUUz3oYnk4Ac6oc2nWWB6iqzg4bHGKDhSRgPRUmFk4wDfS1k 15+uKHOkV1BOLtOxmq34nKnkf+Jp7DU1ynYwhefatan5dIqdcMw9fGUnu9q9sUGWXBA3l NCvsngCCJ7ct4EzYPirElYZtFgMWtSqBct4KIMVpws0vvUZW4VagTthF/05PUOYYb8Avn MZkGHfMEbFp9X+SUy7aNegxjJU2FIfjHUYFQ7NRfrLY6UZXw0gj25VVaKrZiweAgQQQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796296607; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=kS+/yjxS4ucVZrT1g5mXEFI/Jm91GByIuoLEu/H+guI=; b=38QIf8ha+qvcVlZsxNheFYvUDL9oeGtII2chtXDDqoMcro+k5A18QAsZnBGXQudNAz6U OjzbEKMvUq4EoTICnA5lctsgbXHWwDqWazRWC6OkZRMlg96Z7bYzXXoimQyKOduy1050x sX3kcywJPDbLmUeOjj3L+gy3bPBlb0CRa3MclRR2VaIPwYC3flsAkjsm7uFCRntixrpdN 7kvEhuxoLvfRZ9qiwaHGzXO6QUB10Z6oEMtBcALVm/cSPk/wk/3s6LMSk0cqlz1KcNf3M qk+8NdguCZTNJZotPYzlltijwgXp+opGz4Ar4t3QtY/RZmL4xb5n96cU66iJlunQQdQ== 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=WU8GIDNK; 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 2093E606A322; Thu, 3 Dec 2026 11:16:47 +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=WU8GIDNK Received: by smtp.kernel.org (Postfix) with ESMTPSA id C73BF1F00896; Thu, 3 Dec 2026 11:16:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796296607; bh=kS+/yjxS4ucVZrT1g5mXEFI/Jm91GByIuoLEu/H+guI=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=WU8GIDNKBmfXxX82nv8S45vbxNRTk8rBXaQasGDcKViZFlm65l5qBPljEWwF0lts6 iuorK9KG9NMd8yRL1JZoIE+Za+0dBtPgls+S3badNmIz8vv3VIZlzyorhL65iNBgqJ 5Z3VONEJ9+3B04+X4Iml2XOrJBbklE3nxl7tQTnCvgkYR5qkQdSoH75bSmMrjvtF5E F3ujZy0R+v+ewgJdLLAemY1Xre4bVQVoEYY43r8eKi51mpkWHY7c79S6WKpKZVy/Sn BOEr837WQkgWNSehdXr6E2cCaOBdoMO1TJHenpYY8seWp+AcK8djdTxCI9lfXBlkSv oDpVkrAn1YCBw== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v4 3/4] KVM: arm64: selftests: Add a test for VNCR_EL2 translation faults Reply-To: sashiko-reviews@lists.linux.dev To: "Jia He" Cc: kvmarm@lists.linux.dev, kvm@vger.kernel.org, "Oliver Upton" , "Marc Zyngier" In-Reply-To: <20261203105805.165749-4-justin.he@arm.com> References: <20261203105805.165749-1-justin.he@arm.com> <20261203105805.165749-4-justin.he@arm.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 03 Dec 2026 11:16:46 +0000 X-Mailing-List: kvm@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 4 potential issues to consider: - [Medium] KVM: arm64: selftests: missing vGICv3 and NV=3D0 check via test_supports_el2() - [Low] KVM: arm64: selftests: vcpu_get_stat() in TEST_ASSERT() can clobber errno - [Low] KVM: arm64: selftests: nv_vncr_abort omits kselftest TAP reporting wrappers - [Low] KVM: arm64: selftests: empty sigalrm_handler() mishandles EINTR and timeout -- commit 417636aa268598b9f55088e6899197d6effa3e67 Author: Jia He KVM: arm64: selftests: Add a test for VNCR_EL2 translation faults This commit adds an arm64 KVM selftest that enters a nested EL2 context with HCR_EL2.{NV,NV2} and TCR_EL2.HA set, reads VTTBR_EL2 through the VNCR page, and verifies KVM's handling of writable and read-only translation tables with the access flag set or clear. > diff --git a/tools/testing/selftests/kvm/arm64/nv_vncr_abort.c b/tools/te= sting/selftests/kvm/arm64/nv_vncr_abort.c > new file mode 100644 > index 0000000000000..0279a9990d28a > --- /dev/null > +++ b/tools/testing/selftests/kvm/arm64/nv_vncr_abort.c [ ... ] > +static void sigalrm_handler(int sig) > +{ > +} [ ... ] > + alarm(TIMEOUT_SEC); > + ret =3D __vcpu_run(vcpu); > + alarm(0); [Severity: Low] Can an unrelated signal cause a false timeout here, or can a lost SIGALRM leave __vcpu_run() hung indefinitely? sigalrm_handler() does not record SIGALRM delivery, and __vcpu_run() is not retried on EINTR, so any unrelated signal triggers a false timeout failure. Conversely, if the one-shot alarm fires before KVM_RUN entry, the empty handler consumes it and __vcpu_run() can block with no timer armed. Recording SIGALRM in a volatile sig_atomic_t flag, retrying __vcpu_run() while that flag is clear, and checking it around entry (or using a periodic ITIMER_REAL) would handle both cases. > + TEST_ASSERT(!ret || errno !=3D EINTR, > + "%s: vCPU made no progress in %ds (%lu exits)", > + mode_name[mode], TIMEOUT_SEC, vcpu_get_stat(vcpu, exits)); > + TEST_ASSERT(!ret, KVM_IOCTL_ERROR(KVM_RUN, ret)); [Severity: Low] Could vcpu_get_stat(vcpu, exits) clobber errno before it is checked here? TEST_ASSERT() expands to a function call, so vcpu_get_stat() runs on every call in unspecified order relative to errno !=3D EINTR, and before the next TEST_ASSERT() reads errno. On first use, kvm_get_stat() calls calloc() and pread(), which may overwrite errno and corrupt the failure diagnostic. Saving errno immediately after __vcpu_run() and only calling vcpu_get_stat() in the timeout failure branch avoids this and skips the stats lookup on passing runs. [ ... ] > + TEST_REQUIRE(kvm_check_cap(KVM_CAP_ARM_EL2)); [Severity: Medium] Should this use test_supports_el2() instead of checking KVM_CAP_ARM_EL2 directly? KVM_CAP_ARM_EL2 does not check for vGICv3 support, so on hosts without vGICv3 kvm_arch_vm_post_create() leaves vm->arch.has_gic false and the first KVM_RUN fails with -EAGAIN in kvm_vcpu_first_run_init() -> kvm_vgic_vcpu_nv_init() -> kvm_vgic_set_owner() instead of skipping. Using test_supports_el2() also respects the NV=3D0 environment override used by other arm64 nested virtualization selftests. > + TEST_ASSERT(!sigaction(SIGALRM, &sa, NULL), "sigaction failed"); > + > + run_test(RW_PT_AF_CLEAR); > + run_test(RO_PT_AF_SET); > + run_test(RO_PT_AF_CLEAR); > + > + return 0; > +} [Severity: Low] This isn't a bug, but the test prints pass lines with pr_info() in run_test() and returns 0 directly from main() instead of using the kselftest TAP wrappers. Checking prerequisites before calling ksft_print_header() and ksft_set_plan(), then reporting each case with ksft_test_result_pass() and ending with ksft_finished(), would match kselftest conventions and sibling arm64 KVM selftests. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261203105805.1657= 49-1-justin.he@arm.com?part=3D3