From d5ad2233bb43a6bdc84ccb2c9134bece2e2ec94c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Mon, 20 Jul 2026 13:30:52 +0200 Subject: [PATCH] x86/domctl: restore all registers in arch_{get,set}_info_guest() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Commit 9f892f84c279 ("x86/domctl: Stop using XLAT_cpu_user_regs()") converted memcpy() of the cpu_user_regs structure to explicit copy of its fields. In the compat case, it intentionally missed few of them, named in the commit message. But the 64bit case missed also r8-r15 registers, which was not intentional. This, at least, caused Linux 6.18.x crash when resuming PVH domU. Fix it by adding missing assignments. Fixes: 9f892f84c279 ("x86/domctl: Stop using XLAT_cpu_user_regs()") Signed-off-by: Marek Marczykowski-Górecki Reviewed-by: Jan Beulich Reviewed-by: Andrew Cooper Reviewed-by: Teddy Astie master commit: bedbc17d8407c456c7fbe126c0df55610559d8c6 master date: 2026-07-20 11:11:37 +0200 --- xen/arch/x86/domain.c | 8 ++++++++ xen/arch/x86/domctl.c | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index 9af833b6da..893ebaa13a 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -1280,6 +1280,14 @@ int arch_set_info_guest( if ( !compat ) { + v->arch.user_regs.r15 = c.nat->user_regs.r15; + v->arch.user_regs.r14 = c.nat->user_regs.r14; + v->arch.user_regs.r13 = c.nat->user_regs.r13; + v->arch.user_regs.r12 = c.nat->user_regs.r12; + v->arch.user_regs.r11 = c.nat->user_regs.r11; + v->arch.user_regs.r10 = c.nat->user_regs.r10; + v->arch.user_regs.r9 = c.nat->user_regs.r9; + v->arch.user_regs.r8 = c.nat->user_regs.r8; v->arch.user_regs.rbx = c.nat->user_regs.rbx; v->arch.user_regs.rcx = c.nat->user_regs.rcx; v->arch.user_regs.rdx = c.nat->user_regs.rdx; diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c index b8bc0caaf2..40f4cb049c 100644 --- a/xen/arch/x86/domctl.c +++ b/xen/arch/x86/domctl.c @@ -1440,6 +1440,14 @@ void arch_get_info_guest(struct vcpu *v, vcpu_guest_context_u c) if ( !compat ) { /* Backing memory is pre-zeroed. */ + c.nat->user_regs.r15 = v->arch.user_regs.r15; + c.nat->user_regs.r14 = v->arch.user_regs.r14; + c.nat->user_regs.r13 = v->arch.user_regs.r13; + c.nat->user_regs.r12 = v->arch.user_regs.r12; + c.nat->user_regs.r11 = v->arch.user_regs.r11; + c.nat->user_regs.r10 = v->arch.user_regs.r10; + c.nat->user_regs.r9 = v->arch.user_regs.r9; + c.nat->user_regs.r8 = v->arch.user_regs.r8; c.nat->user_regs.rbx = v->arch.user_regs.rbx; c.nat->user_regs.rcx = v->arch.user_regs.rcx; c.nat->user_regs.rdx = v->arch.user_regs.rdx;