[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 7/7] x86/kexec: Zero general purpose registers


  • To: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Kevin Lampis <kevin.lampis@xxxxxxxxxx>
  • Date: Tue, 9 Jun 2026 16:45:18 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=mX8n3a47dmyiQ43p+mrCyQsl4Ss0tUYDgsOf9iF4SZ8=; b=t/IwFyNgPB5vn4y5ftGwCMTiWdZ3C2jXF6uIX6J849k+2cjY1hPvSsSyTjvghgT/ORGd7mrriiB2Hk1cOlVq53ZC3H1xYD3fCP0+zhzo8yvFYEzM7dFhNxYFzuIAtunRJpU9h3nAbtIppnRGa4/21P2QSH51GYmOIIKLJSl8IJgnQ6H4wTMUgf2MSjVLxv54K0fsmEbFMZ+5Xg55hmfnChixPZ38KeZb3KYqXXvfSrNOR9AjQrnj31OmdlB6sRBlBcyI+hZAUdkz1+QPyyHH0TGcBiVeD2FQ0Pe4vSX51M4d1Bp7hfoY3tICgXA5LakJ9nPAIldUtOFDTJD2a5M6mA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=VTk47K9I/PRYcV+dll7d7BwxlGryrM2lsb3bkc7CgE59rNseIX2G1tuTrPTvNs8FhmGSLyPxjWDExfED10ECSy6sFRQvgtwEN1lR5raFRbWoTvd6E2sAdv9pBG2kCWruW3pWdwn2ZDBPHWxvHvvfoCC9yJEki8qerpD7qAu2s3dSzJ2/8yGXtET/VmyaLHStA6VTGKxg5InZbhNl+ZHnuv7ftQXbE7EXxAoZGXBFm88S/aazubI0WfESLuwdktSSSSvi75UuWIoGDSv/R0Q5If+FXAm0SbpqCZ8SM9n/20HrGIliq4gMZd5gi3nGD/1oLCz1De8i5n4qYE2cuBzV9A==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=citrix.com header.i="@citrix.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: jbeulich@xxxxxxxx, andrew.cooper3@xxxxxxxxxx, roger.pau@xxxxxxxxxx, Kevin Lampis <kevin.lampis@xxxxxxxxxx>, Kevin Lampis <klampis@xxxxxxxxxx>
  • Delivery-date: Tue, 09 Jun 2026 15:45:26 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Purgatory zeros these general purpose registers before jumping to the
new kernel. When doing kexec on an EFI kernel there is no purgatory so
we need to zero the registers here instead. This change shouldn't affect
the functionality of legacy kexec.

Signed-off-by: Kevin Lampis <klampis@xxxxxxxxxx>

---
 xen/arch/x86/x86_64/kexec_reloc.S | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/xen/arch/x86/x86_64/kexec_reloc.S 
b/xen/arch/x86/x86_64/kexec_reloc.S
index 6a2c839b83..be9e487f7a 100644
--- a/xen/arch/x86/x86_64/kexec_reloc.S
+++ b/xen/arch/x86/x86_64/kexec_reloc.S
@@ -78,6 +78,20 @@ FUNC(kexec_reloc, PAGE_SIZE)
         testq   $KEXEC_RELOC_FLAG_COMPAT, %r8
         jnz     .L_call_32_bit
 
+        xor %edi, %edi
+        xor %eax, %eax
+        xor %ebx, %ebx
+        xor %ecx, %ecx
+        xor %edx, %edx
+        xor %r8d,  %r8d
+        xor %r9d,  %r9d
+        xor %r10d, %r10d
+        xor %r11d, %r11d
+        xor %r12d, %r12d
+        xor %r13d, %r13d
+        xor %r14d, %r14d
+        xor %r15d, %r15d
+
         /* Jump to the image entry point */
         jmp     *%rbp
 
@@ -94,6 +108,13 @@ FUNC(kexec_reloc, PAGE_SIZE)
         lea     compatibility_mode(%rip), %rax
         push    $0x10
         push    %rax
+
+        xor %edi, %edi
+        xor %eax, %eax
+        xor %ebx, %ebx
+        xor %ecx, %ecx
+        xor %edx, %edx
+
         lretq
 END(kexec_reloc)
 
-- 
2.52.0




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.