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: <20241109162741.GCZy-NfVcTfOLNwzkT@fat_crate.local>
Date: Sat, 9 Nov 2024 17:27:41 +0100
From: Borislav Petkov <bp@...en8.de>
To: Neeraj Upadhyay <Neeraj.Upadhyay@....com>
Cc: linux-kernel@...r.kernel.org, tglx@...utronix.de, mingo@...hat.com,
	dave.hansen@...ux.intel.com, Thomas.Lendacky@....com,
	nikunj@....com, Santosh.Shukla@....com, Vasant.Hegde@....com,
	Suravee.Suthikulpanit@....com, David.Kaplan@....com, x86@...nel.org,
	hpa@...or.com, peterz@...radead.org, seanjc@...gle.com,
	pbonzini@...hat.com, kvm@...r.kernel.org
Subject: Re: [RFC 04/14] x86/apic: Initialize APIC backing page for Secure
 AVIC

On Fri, Nov 08, 2024 at 11:38:15PM +0530, Neeraj Upadhyay wrote:
> As sev_ghcb_msr_read() work with any msr and is not limited to reading
> x2apic msrs, I created a global sev function for it.

That can happen when the functionality is needed somewhere else too.

> Ok sure, I will leave generalizing this to future use cases (if/when they come up)

Yap.

> and provide a secure avic specific function here (will do the same for
> sev_ghcb_msr_write(), which comes later in this series).
> 
> "x2avic" terminology is not used in guest code. As this function only has secure
> avic user, does secure_avic_ghcb_msr_read() work?

That or "savic_..."

> >> +enum lapic_lvt_entry {
> > 
> > What's that enum for?
> 
> It's used in init_backing_page()

Then use it properly:

diff --git a/arch/x86/kernel/apic/x2apic_savic.c b/arch/x86/kernel/apic/x2apic_savic.c
index 99151be4e173..1753c4a71b50 100644
--- a/arch/x86/kernel/apic/x2apic_savic.c
+++ b/arch/x86/kernel/apic/x2apic_savic.c
@@ -200,8 +200,8 @@ static void x2apic_savic_send_IPI_mask_allbutself(const struct cpumask *mask, in
 
 static void init_backing_page(void *backing_page)
 {
+	enum lapic_lvt_entry i;
 	u32 val;
-	int i;
 
 	val = read_msr_from_hv(APIC_LVR);
 	set_reg(backing_page, APIC_LVR, val);

> >> +		pr_err("Secure AVIC msr (%#llx) read returned error (%d)\n", msr, ret);
> > 
> > Prepend "0x" to the format specifier.
> > 
> 
> Using '#' prepends "0x". Am I missing something here?

Let's use the common thing pls even if the alternate form works too:

$ git grep "\"%#" | wc -l
411
$ git grep "\"0x" | wc -l
112823

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ