public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] x86/sev-es: Resolve early #VC handler UB
@ 2023-09-12  0:27 Adam Dunlap
  2023-09-12  0:27 ` [PATCH v2 1/2] x86/sev-es: Allow copy_from_kernel_nofault in earlier boot Adam Dunlap
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Adam Dunlap @ 2023-09-12  0:27 UTC (permalink / raw)
  To: linux-kernel, x86, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin, Andy Lutomirski, Peter Zijlstra,
	Sean Christopherson, Kim Phillips, Juergen Gross, Ashok Raj,
	Adam Dunlap, Joerg Roedel
  Cc: Tom Lendacky, David Hildenbrand, Mike Rapoport,
	Kirill A. Shutemov, Nikunj A Dadhania, Dionna Glaze, Peter Gonda,
	David Rientjes, Khalid ElMously, Jacob Xu

In v0 of this patch, I mistakenly claimed that
boot_cpu_data.x86_virt_bits was not getting set to 0 in some
configurations. However, it is in fact reliably being set to 0 because
it is specified to be in the .data..read_mostly section, and .data is
initialized at this point. The boot failures that we were seeing were
actually due to the gcc 12.3 compiler exploiting the undefined
behavior to return false from __is_canonical_address when
boot_cpu_data.x86_virt_bits is 0.

This patch set applies the 2 changes posted by Dave Hansen: remove the
UB by explicily checking for 0, and remove the period of time where
x86_virt_bits may be temporarily set to the wrong value where the #VC
handler could observe it.


Adam Dunlap (2):
  x86/sev-es: Allow copy_from_kernel_nofault in earlier boot
  x86/sev-es: Only set x86_virt_bits to correct value

 arch/x86/kernel/cpu/common.c | 37 +++++++++++++++++++++---------------
 arch/x86/mm/maccess.c        | 19 +++++++++++++-----
 2 files changed, 36 insertions(+), 20 deletions(-)

-- 
2.42.0.283.g2d96d420d3-goog


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2023-10-03  7:38 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-12  0:27 [PATCH v2 0/2] x86/sev-es: Resolve early #VC handler UB Adam Dunlap
2023-09-12  0:27 ` [PATCH v2 1/2] x86/sev-es: Allow copy_from_kernel_nofault in earlier boot Adam Dunlap
2023-09-20 20:37   ` Sean Christopherson
2023-09-20 22:54     ` Dave Hansen
2023-09-28 21:11   ` [tip: x86/mm] x86/sev-es: Allow copy_from_kernel_nofault() " tip-bot2 for Adam Dunlap
2023-09-12  0:27 ` [PATCH v2 2/2] x86/sev-es: Only set x86_virt_bits to correct value Adam Dunlap
2023-09-28 21:11   ` [tip: x86/mm] x86/sev-es: Set x86_virt_bits to the correct value straight away, instead of a two-phase approach tip-bot2 for Adam Dunlap
2023-10-02 20:04   ` [PATCH v2 2/2] x86/sev-es: Only set x86_virt_bits to correct value Nathan Chancellor
2023-10-02 21:41     ` Dave Hansen
2023-10-02 21:46       ` Adam Dunlap
2023-10-02 22:00     ` [PATCH] x86/boot: Move x86_cache_alignment initialization to correct spot Dave Hansen
2023-10-02 22:24       ` Nathan Chancellor
2023-10-03  7:28         ` Ingo Molnar
2023-10-03  7:38       ` [tip: x86/mm] " tip-bot2 for Dave Hansen
2023-09-28 20:51 ` [PATCH v2 0/2] x86/sev-es: Resolve early #VC handler UB Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox