From: hshoexer Subject: SEV-SNP: Add memory clobber to vmgexit() 2/5 To: tech@openbsd.org Date: Thu, 24 Sep 2026 18:12:45 +0200 Hi, this change is also useful for SEV-ES guests. The hypervisor reads and writes the GHCB while handling a VMGEXIT. Without a memory clobber the compiler may cache GHCB contents across the instruction. "asm volatile" alone does not prevent that. No change in generated code. ok? Take care, HJ. --- sys/arch/amd64/include/cpufunc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/arch/amd64/include/cpufunc.h b/sys/arch/amd64/include/cpufunc.h index 96af50a82a5..6e8b63abf4f 100644 --- a/sys/arch/amd64/include/cpufunc.h +++ b/sys/arch/amd64/include/cpufunc.h @@ -436,7 +436,7 @@ static __inline void vmgexit(void) { /* rep; vmmcall encodes the vmgexit instruction */ - __asm volatile("rep; vmmcall"); + __asm volatile("rep; vmmcall" : : : "memory"); } void amd64_errata(struct cpu_info *); -- 2.47.3