lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220605064342.309219-2-jiangshanlai@gmail.com>
Date:   Sun,  5 Jun 2022 14:43:31 +0800
From:   Lai Jiangshan <jiangshanlai@...il.com>
To:     linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
        Paolo Bonzini <pbonzini@...hat.com>
Cc:     Sean Christopherson <seanjc@...gle.com>,
        Vitaly Kuznetsov <vkuznets@...hat.com>,
        Maxim Levitsky <mlevitsk@...hat.com>,
        Lai Jiangshan <jiangshan.ljs@...group.com>
Subject: [PATCH 01/12] KVM: X86/MMU: Warn if sp->unsync_children > 0 in link_shadow_page()

From: Lai Jiangshan <jiangshan.ljs@...group.com>

The check for sp->unsync_children in link_shadow_page() can be removed
since FNAME(fetch) ensures it is zero.  (@sp is direct when
link_shadow_page() is called from other places, which also means
sp->unsync_children is zero.)

link_shadow_page() is not a fast path, check it and warn instead.

Signed-off-by: Lai Jiangshan <jiangshan.ljs@...group.com>
---
 arch/x86/kvm/mmu/mmu.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
index 086f32dffdbe..f61416818116 100644
--- a/arch/x86/kvm/mmu/mmu.c
+++ b/arch/x86/kvm/mmu/mmu.c
@@ -2197,7 +2197,13 @@ static void link_shadow_page(struct kvm_vcpu *vcpu, u64 *sptep,
 
 	mmu_page_add_parent_pte(vcpu, sp, sptep);
 
-	if (sp->unsync_children || sp->unsync)
+	/*
+	 * Propagate the unsync bit when sp->unsync.
+	 *
+	 * The caller ensures the sp is synced when it has unsync children,
+	 * so sp->unsync_children must be zero.  See FNAME(fetch).
+	 */
+	if (sp->unsync || WARN_ON_ONCE(sp->unsync_children))
 		mark_unsync(sptep);
 }
 
-- 
2.19.1.6.gb485710b

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ