xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Cc: "Andrew Cooper" <andrew.cooper3@citrix.com>,
	"M. Vefa Bicakci" <m.v.b@runbox.com>, "Wei Liu" <wl@xen.org>,
	"Roger Pau Monné" <roger.pau@citrix.com>
Subject: [PATCH] x86/S3: put data segment registers into known state upon resume
Date: Mon, 20 Jul 2020 17:20:15 +0200	[thread overview]
Message-ID: <3cad2798-1a01-7d5e-ea55-ddb9ba6388d9@suse.com> (raw)

wakeup_32 sets %ds and %es to BOOT_DS, while leaving %fs at what
wakeup_start did set it to, and %gs at whatever BIOS did load into it.
All of this may end up confusing the first load_segments() to run on
the BSP after resume, in particular allowing a non-nul selector value
to be left in %fs.

Alongside %ss, also put all other data segment registers into the same
state that the boot and CPU bringup paths put them in.

Reported-by: M. Vefa Bicakci <m.v.b@runbox.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/arch/x86/acpi/wakeup_prot.S
+++ b/xen/arch/x86/acpi/wakeup_prot.S
@@ -52,6 +52,16 @@ ENTRY(s3_resume)
         mov     %eax, %ss
         mov     saved_rsp(%rip), %rsp
 
+        /*
+         * Also put other segment registers into known state, like would
+         * be done on the boot path. This is in particular necessary for
+         * the first load_segments() to work as intended.
+         */
+        mov     %eax, %ds
+        mov     %eax, %es
+        mov     %eax, %fs
+        mov     %eax, %gs
+
         /* Reload code selector */
         pushq   $__HYPERVISOR_CS
         leaq    1f(%rip),%rax


             reply	other threads:[~2020-07-20 15:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-20 15:20 Jan Beulich [this message]
2020-07-21 11:27 ` [PATCH] x86/S3: put data segment registers into known state upon resume Roger Pau Monné
2020-07-23 14:40 ` Andrew Cooper
2020-07-23 15:19   ` Jan Beulich
2020-07-23 16:00     ` Andrew Cooper
2020-07-29 23:29       ` M. Vefa Bicakci
2020-07-29 23:31         ` Andrew Cooper
2020-07-29 23:38           ` M. Vefa Bicakci

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=3cad2798-1a01-7d5e-ea55-ddb9ba6388d9@suse.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=m.v.b@runbox.com \
    --cc=roger.pau@citrix.com \
    --cc=wl@xen.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).