All of lore.kernel.org
 help / color / mirror / Atom feed
From: Frediano Ziglio <freddy77@gmail.com>
To: xen-devel@lists.xenproject.org
Cc: "Frediano Ziglio" <freddy77@gmail.com>,
	"Jan Beulich" <jbeulich@suse.com>,
	"Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Roger Pau Monné" <roger@xenproject.org>,
	"Teddy Astie" <teddy.astie@vates.tech>,
	"Claude Opus 5 . 5" <noreply@anthropic.com>
Subject: [PATCH 01/11] x86/boot: Prevent some possible firmware misbehaviour
Date: Fri,  4 Dec 2026 20:50:34 +0000	[thread overview]
Message-ID: <20261204205045.596093-2-freddy77@gmail.com> (raw)
In-Reply-To: <20261204205045.596093-1-freddy77@gmail.com>

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@gmail.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---
 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



  reply	other threads:[~2026-12-04 20:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04 20:50 [PATCH 00/11] x86/boot: Improve trampoline code Frediano Ziglio
2026-12-04 20:50 ` Frediano Ziglio [this message]
2026-12-04 20:50 ` [PATCH 02/11] x86/boot: Avoid PE relocations in the trampoline Frediano Ziglio
2026-12-04 20:50 ` [PATCH 03/11] x86/boot: Check at build time that the trampoline needs no relocations Frediano Ziglio
2026-12-04 20:50 ` [PATCH 04/11] x86/boot: Reduce relocations in the trampoline Frediano Ziglio
2026-12-04 20:50 ` [PATCH 05/11] x86/boot: Share the switch to 64-bit mode between SIPI and S3 paths Frediano Ziglio
2026-12-04 20:50 ` [PATCH 06/11] x86/boot: Use stack to remove a relocation from trampoline code Frediano Ziglio
2026-12-04 20:50 ` [PATCH 07/11] x86/boot: Apply relocations in the trampoline after the copy Frediano Ziglio
2026-12-04 20:50 ` [PATCH 08/11] x86/boot: Group trampoline code and data using subsections Frediano Ziglio
2026-12-04 20:50 ` [PATCH 09/11] x86/boot: Use a writable copy of the trampoline data Frediano Ziglio
2026-12-04 20:50 ` [PATCH 10/11] x86/boot: Assemble the trampoline separately from head.S Frediano Ziglio
2026-12-04 20:50 ` [PATCH 11/11] x86/boot: Check the kind of symbols passed to the bootsym helpers Frediano Ziglio

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261204205045.596093-2-freddy77@gmail.com \
    --to=freddy77@gmail.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=noreply@anthropic.com \
    --cc=roger@xenproject.org \
    --cc=teddy.astie@vates.tech \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.