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: <20220321094203.109546-2-darcy.sh@antgroup.com>
Date:   Mon, 21 Mar 2022 17:42:03 +0800
From:   "SU Hang" <darcy.sh@...group.com>
To:     kvm@...r.kernel.org
Cc:     "赖江山" <jiangshan.ljs@...group.com>,
        "SU Hang" <darcy.sh@...group.com>,
        "Paolo Bonzini" <pbonzini@...hat.com>,
        "Sean Christopherson" <seanjc@...gle.com>,
        "Vitaly Kuznetsov" <vkuznets@...hat.com>,
        "Wanpeng Li" <wanpengli@...cent.com>,
        "Jim Mattson" <jmattson@...gle.com>,
        "Joerg Roedel" <joro@...tes.org>,
        "Thomas Gleixner" <tglx@...utronix.de>,
        "Ingo Molnar" <mingo@...hat.com>, "Borislav Petkov" <bp@...en8.de>,
        "Dave Hansen" <dave.hansen@...ux.intel.com>, <x86@...nel.org>,
        "H. Peter Anvin" <hpa@...or.com>, <linux-kernel@...r.kernel.org>
Subject: [PATCH 2/2] KVM: X86: use EPT_VIOLATION_* instead of 0x7

Use symbolic value, EPT_VIOLATION_*, instead of 0x7
in FNAME(walk_addr_generic)().

Signed-off-by: SU Hang <darcy.sh@...group.com>
---
 arch/x86/kvm/mmu/paging_tmpl.h | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kvm/mmu/paging_tmpl.h b/arch/x86/kvm/mmu/paging_tmpl.h
index 7853c7ef13a1..2e2b1f7ccaca 100644
--- a/arch/x86/kvm/mmu/paging_tmpl.h
+++ b/arch/x86/kvm/mmu/paging_tmpl.h
@@ -531,7 +531,12 @@ static int FNAME(walk_addr_generic)(struct guest_walker *walker,
 			vcpu->arch.exit_qualification |= EPT_VIOLATION_ACC_READ;
 		if (fetch_fault)
 			vcpu->arch.exit_qualification |= EPT_VIOLATION_ACC_INSTR;
-		vcpu->arch.exit_qualification |= (pte_access & 0x7) << 3;
+		if (pte_access & ACC_USER_MASK)
+			vcpu->arch.exit_qualification |= EPT_VIOLATION_READABLE;
+		if (pte_access & ACC_WRITE_MASK)
+			vcpu->arch.exit_qualification |= EPT_VIOLATION_WRITABLE;
+		if (pte_access & ACC_EXEC_MASK)
+			vcpu->arch.exit_qualification |= EPT_VIOLATION_EXECUTABLE;
 	}
 #endif
 	walker->fault.address = addr;
-- 
2.32.0.3.g01195cf9f

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ