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

[PATCH 01/11] x86/boot: Prevent some possible firmware misbehaviour



Check the option ROM has a valid header before calling it.
Reset flags after calling the option ROM.

These changes were made after talking with AI about 0xc000:3 address.

Signed-off-by: Frediano Ziglio <freddy77@xxxxxxxxx>
Co-Authored-By: Claude Opus 5.5 <noreply@xxxxxxxxxxxxx>
---
 xen/arch/x86/boot/wakeup.S | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/xen/arch/x86/boot/wakeup.S b/xen/arch/x86/boot/wakeup.S
index 654e97005f..1f5af77745 100644
--- a/xen/arch/x86/boot/wakeup.S
+++ b/xen/arch/x86/boot/wakeup.S
@@ -39,11 +39,18 @@ ENTRY(entry_S3)
         # for acpi_sleep=s3_bios
         testb   $1, wakesym(video_flags)
         jz      1f
+        mov     $0xc000, %ax
+        mov     %ax, %fs
+        cmpw    $0xaa55, %fs:0  # check BIOS signature
+        jne     1f
         lcall   $0xc000, $3
         movw    %cs, %ax        # In case messed by BIOS
         movw    %ax, %ds
         movw    %ax, %ss        # Need this? How to ret if clobbered?
 
+        pushl   $0              # Flags may have been messed by BIOS too
+        popfl
+
 1:      # for acpi_sleep=s3_mode
         testb   $2, wakesym(video_flags)
         jz      1f
-- 
2.43.0




 


Rackspace

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