[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <519a5116-a48a-61f9-9a93-d30d21eb7e75@intel.com>
Date: Wed, 20 Sep 2023 15:54:14 -0700
From: Dave Hansen <dave.hansen@...el.com>
To: Sean Christopherson <seanjc@...gle.com>,
Adam Dunlap <acdunlap@...gle.com>
Cc: linux-kernel@...r.kernel.org, x86@...nel.org,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>,
"H. Peter Anvin" <hpa@...or.com>,
Andy Lutomirski <luto@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Kim Phillips <kim.phillips@....com>,
Juergen Gross <jgross@...e.com>,
Ashok Raj <ashok.raj@...el.com>,
Joerg Roedel <jroedel@...e.de>,
Tom Lendacky <thomas.lendacky@....com>,
David Hildenbrand <david@...hat.com>,
Mike Rapoport <rppt@...nel.org>,
"Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
Nikunj A Dadhania <nikunj@....com>,
Dionna Glaze <dionnaglaze@...gle.com>,
Peter Gonda <pgonda@...gle.com>,
David Rientjes <rientjes@...gle.com>,
Khalid ElMously <khalid.elmously@...onical.com>,
Jacob Xu <jacobhxu@...gle.com>
Subject: Re: [PATCH v2 1/2] x86/sev-es: Allow copy_from_kernel_nofault in
earlier boot
On 9/20/23 13:37, Sean Christopherson wrote:
> On Mon, Sep 11, 2023, Adam Dunlap wrote:
>> Previously, if copy_from_kernel_nofault was called before
>> boot_cpu_data.x86_virt_bits was set up, then it would trigger undefined
>> behavior due to a shift by 64. This ended up causing boot failures in
>> the latest version of ubuntu2204 in the gcp project when using SEV-SNP.
>> Specifically, this function is called during an early #VC handler which
>> is triggered by a cpuid to check if nx is implemented.
> Why not stuff boot_cpu_data.x86_virt_bits to a "default" value that is guaranteed
> to be accurate (or at least safe) for the purposes of the early boot code. I.e.
> set it to 48 for 64-bit kernels.
>
> That'd avoid the extra conditional, and would avoid laying whack-a-mole with
> anything else that consumes x86_virt_bits.
I'd be worried that could break things even more subtly.
If we're truly worried about whack-a-mole, we should stick
'x86_virt_bits' in a wrapper, whine if it's accessed inadvertently, and
*then* return some mostly sane data.
That way we can actually go look at the caller and see what the heck
it's doing.
I did poke around and managed to convince myself that this site _is_ the
only one at the moment.
Powered by blists - more mailing lists