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

Re: [Xen-devel] [PATCH] x86/boot: Further minor GDT corrections



On 19.08.2019 15:42, Andrew Cooper wrote:
gdt_boot_descr and gdt_48 disagree on how long trampoline_gdt is.

Introduce an end label and have the linker calculate the size, rather than
hard coding it.

Also, just as with c/s af292b41e9, there is no point forcing the CPU to set
Access bits.  Fix all remaining GDTs in Xen.

Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
CC: Jan Beulich <JBeulich@xxxxxxxx>
CC: Wei Liu <wl@xxxxxxx>
CC: Roger Pau Monné <roger.pau@xxxxxxxxxx>

The trampoline GDT access bits were actually noticed when trying to clean up
our boot time pagetables and map the trampoline read-only.
---
  xen/arch/x86/boot/head.S          |  2 +-
  xen/arch/x86/boot/trampoline.S    | 15 ++++++++-------
  xen/arch/x86/x86_64/kexec_reloc.S |  4 ++--
  3 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S
index 26b680521d..9fdb9b3954 100644
--- a/xen/arch/x86/boot/head.S
+++ b/xen/arch/x86/boot/head.S
@@ -129,7 +129,7 @@ multiboot2_header:
.word 0
  gdt_boot_descr:
-        .word   7*8-1
+        .word   .Ltramopline_gdt_end - trampoline_gdt - 1
  gdt_boot_base:
          .long   sym_offs(trampoline_gdt)
          .long   0 /* Needed for 64-bit lgdt */
diff --git a/xen/arch/x86/boot/trampoline.S b/xen/arch/x86/boot/trampoline.S
index 7c6a2328d2..1761fc1213 100644
--- a/xen/arch/x86/boot/trampoline.S
+++ b/xen/arch/x86/boot/trampoline.S
@@ -63,22 +63,23 @@ trampoline_gdt:
          /* 0x0000: unused */
          .quad   0x0000000000000000
          /* 0x0008: ring 0 code, 32-bit mode */
-        .quad   0x00cf9a000000ffff
+        .quad   0x00cf9b000000ffff
          /* 0x0010: ring 0 code, 64-bit mode */
-        .quad   0x00af9a000000ffff
+        .quad   0x00af9b000000ffff
          /* 0x0018: ring 0 data */
-        .quad   0x00cf92000000ffff
+        .quad   0x00cf93000000ffff
          /* 0x0020: real-mode code @ BOOT_TRAMPOLINE */
          .long   0x0000ffff
-        .long   0x00009a00
+        .long   0x00009b00
          /* 0x0028: real-mode data @ BOOT_TRAMPOLINE */
          .long   0x0000ffff
-        .long   0x00009200
+        .long   0x00009300
          /*
           * 0x0030: ring 0 Xen data, 16 MiB size, base
           * address is computed at runtime.
           */
-        .quad   0x00c0920000000fff
+        .quad   0x00c0930000000fff
+.Ltramopline_gdt_end:

With the typo here fixed

Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>

But may I talk you into ...

--- a/xen/arch/x86/x86_64/kexec_reloc.S
+++ b/xen/arch/x86/x86_64/kexec_reloc.S
@@ -182,8 +182,8 @@ compat_mode_gdt_desc:
          .align 8
  compat_mode_gdt:
          .quad 0x0000000000000000     /* null                              */
-        .quad 0x00cf92000000ffff     /* 0x0008 ring 0 data                */
-        .quad 0x00cf9a000000ffff     /* 0x0010 ring 0 code, compatibility */
+        .quad 0x00cf93000000ffff     /* 0x0008 ring 0 data                */
+        .quad 0x00cf9b000000ffff     /* 0x0010 ring 0 code, compatibility */

... introducing a similar "end" label here and using it at
compat_mode_gdt_desc (the R-b above stands with that change)?

Jan

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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