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: <20200915140701.167300561@linuxfoundation.org>
Date:   Tue, 15 Sep 2020 16:13:47 +0200
From:   Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To:     linux-kernel@...r.kernel.org
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        stable@...r.kernel.org, Gavin Shan <gshan@...hat.com>,
        Eric Auger <eric.auger@...hat.com>,
        Alexandru Elisei <alexandru.elisei@....com>,
        Marc Zyngier <maz@...nel.org>
Subject: [PATCH 5.8 156/177] KVM: arm64: Do not try to map PUDs when they are folded into PMD

From: Marc Zyngier <maz@...nel.org>

commit 3fb884ffe921c99483a84b0175f3c03f048e9069 upstream.

For the obscure cases where PMD and PUD are the same size
(64kB pages with 42bit VA, for example, which results in only
two levels of page tables), we can't map anything as a PUD,
because there is... erm... no PUD to speak of. Everything is
either a PMD or a PTE.

So let's only try and map a PUD when its size is different from
that of a PMD.

Cc: stable@...r.kernel.org
Fixes: b8e0ba7c8bea ("KVM: arm64: Add support for creating PUD hugepages at stage 2")
Reported-by: Gavin Shan <gshan@...hat.com>
Reported-by: Eric Auger <eric.auger@...hat.com>
Reviewed-by: Alexandru Elisei <alexandru.elisei@....com>
Reviewed-by: Gavin Shan <gshan@...hat.com>
Tested-by: Gavin Shan <gshan@...hat.com>
Tested-by: Eric Auger <eric.auger@...hat.com>
Tested-by: Alexandru Elisei <alexandru.elisei@....com>
Signed-off-by: Marc Zyngier <maz@...nel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>

---
 arch/arm64/kvm/mmu.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

--- a/arch/arm64/kvm/mmu.c
+++ b/arch/arm64/kvm/mmu.c
@@ -1968,7 +1968,12 @@ static int user_mem_abort(struct kvm_vcp
 		(fault_status == FSC_PERM &&
 		 stage2_is_exec(kvm, fault_ipa, vma_pagesize));
 
-	if (vma_pagesize == PUD_SIZE) {
+	/*
+	 * If PUD_SIZE == PMD_SIZE, there is no real PUD level, and
+	 * all we have is a 2-level page table. Trying to map a PUD in
+	 * this case would be fatally wrong.
+	 */
+	if (PUD_SIZE != PMD_SIZE && vma_pagesize == PUD_SIZE) {
 		pud_t new_pud = kvm_pfn_pud(pfn, mem_type);
 
 		new_pud = kvm_pud_mkhuge(new_pud);


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ