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=1796342873; b=MCjtmOUanPbmwMQXL0599YPdE5fdjYa+BRe74SgMabur8tPO/lvGdTAVirt6rhR674DM 1CCQkfPUqmBsSBolsoODHI7z7Havxd69lTYEhbukOntIh+ZKa2oxpAQpdPH22INf6Jqcn qVurc68ln0ZLk8qjLmLvATSMJKWU+UrxrILGzAQmtY3O4xfMQ7mxtF3UWOSeWUBDQT7kV 5jqtPCs3lIa/+MvqUoispQtPj1zkkWIE2OIKAeaj+CUZP6j3pDdFS+9ttfb/xqfNEC62b rGwG1LtMHm/DKik58f5BZTfF03WAX/ZV4tHPrJh+D5JptIi7DJD9FB+ppPrkRWvL+ow== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796342873; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=jbSpFvPPp2JsM9goAwvndSJZEsgtRclRv3z4kxF2QwE=; b=zBVk4l5O4dDtI9KIpA2P7FtdDhJeZPP39zdtRb6wL5LON4TWjinSqFq/A30L0MpRjPF2 FZfN2GGyI93/hr8x6kj6MHjXfmTKq//H0PL7yRlaYBK1hCd4d2nCYvpvFLPtvz+L2XVBx mhfF2YRu/4SSO7VKqvvWituT1hf+2I4XW8+srgfP0Bt0W32mBM5GIfMyeZZoXSnuCCuuu IWQE2d1GUTNmHJnGszrJlxA+cr+tHhpMbc5K/IEyg4MU7qOrgd0QsDzE5eVAYxgYzirs5 RP0id5VpJYNPKkhB4q4JRlkZNvIzAFrEho6R9RK1gN/ElMO+ihANNj0JMH3QaYioYnA== 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=GLuoiH2Z; 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 7B86C606A322 for ; Fri, 4 Dec 2026 00:07:53 +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=GLuoiH2Z Received: by smtp.kernel.org (Postfix) with ESMTPSA id ECFBA1F00897; Fri, 4 Dec 2026 00:07:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796342873; bh=jbSpFvPPp2JsM9goAwvndSJZEsgtRclRv3z4kxF2QwE=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=GLuoiH2ZW9zvI38h7/NhZabXcxbLn0DFSKrRHfDa9gJ6tv2TSRX3ZAL3yrdzPQR+R wyqJx01dRknCUzyLuSRIN6dWWmlg+Olx7QuaS0ULwHU/b4mNN0FCeBIeHyEhZ8onOq SOuIWQsGCH4oEwxiKhpf/xND6oXib4xxGI2hSVQssaii9kNEKoy9eNVYcTzBMmQWLX uZjDyox/TUflJskb/Ega6/6JE70dMkGh4W+DV94d4WPFdCeE8xL34nbA7V2vKZ6yKW HWTEGwVQ1tBg6tJCJvF2gc2QC+A2bqrrTET7sQXtsOLdmL8bXPRS6jXLRJFud93mQG 375LTPeZ242wA== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH 09/10] KVM: selftests: Add nested EPT mode-based execute control test Reply-To: sashiko-reviews@lists.linux.dev To: =?utf-8?b?RGVubmlzIFJldcOfd2ln?= Cc: kvm@vger.kernel.org In-Reply-To: <20261204-nested-sss-v1-9-57de06f58b2b@reusswig.codes> References: <20261204-nested-sss-v1-0-57de06f58b2b@reusswig.codes> <20261204-nested-sss-v1-9-57de06f58b2b@reusswig.codes> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 00:07:52 +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 2 potential issues to consider: - [Medium] KVM: selftests: vmx_nested_mbec_test omits user-mode linear address fetches - [Low] KVM: selftests: vmx_nested_mbec_test lacks kselftest TAP and skip reporting -- commit d5eb6cc0d63627ad6ee5a99f17c015398b86328a Author: Dennis Reu=C3=9Fwig KVM: selftests: Add nested EPT mode-based execute control test This commit adds a KVM x86 selftest that runs an L2 guest under L1 EPT entries with varying supervisor and user execute permissions, with and without mode-based execute control enabled, and checks the resulting instruction fetches and EPT violation exit qualifications. > diff --git a/tools/testing/selftests/kvm/x86/vmx_nested_mbec_test.c b/too= ls/testing/selftests/kvm/x86/vmx_nested_mbec_test.c > new file mode 100644 > index 0000000000000..652b685466d57 > --- /dev/null > +++ b/tools/testing/selftests/kvm/x86/vmx_nested_mbec_test.c [ ... ] > +static void run_test(const struct mbec_test *t) > +{ [ ... ] > + /* A supervisor, executable mapping of the code page in L2's page table= s. */ > + code_gpa =3D vm_phy_page_alloc(vm, MEM_REGION_DATA); > + *(u8 *)addr_gpa2hva(vm, code_gpa) =3D 0xc3; /* RET */ > + virt_pg_map(vm, CODE_GVA, CODE_L2_GPA); [Severity: Medium] Should this test also exercise user-mode linear address fetches? virt_pg_map() leaves PTE_USER_MASK clear at every L2 paging level, so CODE_GVA is always a supervisor-mode linear address. Across tests[], the fetch succeeds iff xs is set, and the only difference with mbec enabled is EPT_VIOLATION_PROT_USER_EXEC on one case. As a result, the test still passes if KVM fails to enable MBEC in vmcs02, fails to translate EPT_VIOLATION_GVA_USER to PFERR_USER_MASK in __vt_handle_ept_violation(), or never selects ~xu in __update_permission_bitmask(). Since kvm_get_default_cr4() leaves X86_CR4_SMEP clear, setting PTE_USER_MASK on all L2 paging levels for CODE_GVA would let L2 at CPL 0 test user-mode linear address fetches without switching to ring 3. [ ... ] > +int main(int argc, char *argv[]) > +{ > + bool has_mbec; > + int i; > + > + TEST_REQUIRE(kvm_cpu_has(X86_FEATURE_VMX)); > + TEST_REQUIRE(kvm_cpu_has_ept()); > + > + has_mbec =3D kvm_cpu_has_secondary_exec_control(SECONDARY_EXEC_MODE_BAS= ED_EPT_EXEC); > + if (!has_mbec) > + pr_info("MBEC not offered to L1, running only the cases without MBEC\n= "); > + > + for (i =3D 0; i < ARRAY_SIZE(tests); i++) { > + if (tests[i].mbec && !has_mbec) > + continue; > + run_test(&tests[i]); > + } > + > + return 0; > +} [Severity: Low] Could this report subtest results through kselftest.h instead of pr_info() and a bare return 0? When MBEC is not offered to L1 (such as on CPUs without MBEC or with kvm_intel.mbec=3D0), all four MBEC cases are silently skipped and make run_tests records an unconditional pass with no TAP skip status or reason. Using the kselftest.h wrappers already pulled in by test_util.h (ksft_print_header(), ksft_set_plan(), ksft_test_result_pass(), ksft_test_result_skip(), and ksft_finished()) would emit structured pass and skip results for each subtest. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261204-nested-sss= -v1-0-57de06f58b2b@reusswig.codes?part=3D9