From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xen.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
Jan Beulich <JBeulich@suse.com>
Subject: [PATCH 1/2] x86/layout: Correct Xen's idea of its own memory layout
Date: Tue, 28 Feb 2017 15:20:17 +0000 [thread overview]
Message-ID: <1488295218-26057-1-git-send-email-andrew.cooper3@citrix.com> (raw)
c/s b4cd59fe "x86: reorder .data and .init when linking" had an unintended
side effect, where xen_in_range() and the tboot S3 MAC were no longer correct.
In practice, it means that Xen's .data section is excluded from consideration,
which means:
1) Default IOMMU construction for the hardware domain could create mappings.
2) .data isn't included in the tboot MAC checked on resume from S3.
Adjust the comments and virtual address anchors used to define the regions.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
---
xen/arch/x86/setup.c | 14 +++++++-------
xen/arch/x86/tboot.c | 12 +++++++-----
2 files changed, 14 insertions(+), 12 deletions(-)
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 66b7aba..dab67d5 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1685,7 +1685,7 @@ int __hwdom_init xen_in_range(unsigned long mfn)
paddr_t start, end;
int i;
- enum { region_s3, region_text, region_bss, nr_regions };
+ enum { region_s3, region_ro, region_rw, nr_regions };
static struct {
paddr_t s, e;
} xen_regions[nr_regions] __hwdom_initdata;
@@ -1696,12 +1696,12 @@ int __hwdom_init xen_in_range(unsigned long mfn)
/* S3 resume code (and other real mode trampoline code) */
xen_regions[region_s3].s = bootsym_phys(trampoline_start);
xen_regions[region_s3].e = bootsym_phys(trampoline_end);
- /* hypervisor code + data */
- xen_regions[region_text].s =__pa(&_stext);
- xen_regions[region_text].e = __pa(&__init_begin);
- /* bss */
- xen_regions[region_bss].s = __pa(&__bss_start);
- xen_regions[region_bss].e = __pa(&__bss_end);
+ /* hypervisor .text + .rodata */
+ xen_regions[region_ro].s = __pa(&_stext);
+ xen_regions[region_ro].e = __pa(&__2M_rodata_end);
+ /* hypervisor .data + .bss */
+ xen_regions[region_rw].s = __pa(&__2M_rwdata_start);
+ xen_regions[region_rw].e = __pa(&__2M_rwdata_end);
}
start = (paddr_t)mfn << PAGE_SHIFT;
diff --git a/xen/arch/x86/tboot.c b/xen/arch/x86/tboot.c
index eac182d..a0d1d0f 100644
--- a/xen/arch/x86/tboot.c
+++ b/xen/arch/x86/tboot.c
@@ -11,6 +11,7 @@
#include <asm/processor.h>
#include <asm/e820.h>
#include <asm/tboot.h>
+#include <asm/setup.h>
#include <crypto/vmac.h>
/* tboot=<physical address of shared page> */
@@ -369,13 +370,14 @@ void tboot_shutdown(uint32_t shutdown_type)
g_tboot_shared->mac_regions[0].start = bootsym_phys(trampoline_start);
g_tboot_shared->mac_regions[0].size = bootsym_phys(trampoline_end) -
bootsym_phys(trampoline_start);
- /* hypervisor code + data */
+ /* hypervisor .text + .rodata */
g_tboot_shared->mac_regions[1].start = (uint64_t)__pa(&_stext);
- g_tboot_shared->mac_regions[1].size = __pa(&__init_begin) -
+ g_tboot_shared->mac_regions[1].size = __pa(&__2M_rodata_end) -
__pa(&_stext);
- /* bss */
- g_tboot_shared->mac_regions[2].start = (uint64_t)__pa(&__bss_start);
- g_tboot_shared->mac_regions[2].size = __pa(&__bss_end) - __pa(&__bss_start);
+ /* hypervisor .data + .bss */
+ g_tboot_shared->mac_regions[2].start = (uint64_t)__pa(&__2M_rwdata_start);
+ g_tboot_shared->mac_regions[2].size = __pa(&__2M_rwdata_end) -
+ __pa(&__2M_rwdata_start);
/*
* MAC domains and other Xen memory
--
2.1.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next reply other threads:[~2017-02-28 15:20 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-28 15:20 Andrew Cooper [this message]
2017-02-28 15:20 ` [PATCH 2/2] efi/boot: Don't free ebmalloc area at all Andrew Cooper
2017-02-28 16:03 ` Jan Beulich
2017-02-28 16:08 ` Andrew Cooper
2017-02-28 16:14 ` Jan Beulich
2017-02-28 17:09 ` Daniel Kiper
2017-02-28 17:24 ` Jan Beulich
2017-02-28 18:45 ` Daniel Kiper
2017-03-01 7:48 ` Jan Beulich
2017-03-01 8:20 ` Daniel Kiper
2017-03-01 8:47 ` Jan Beulich
2017-03-01 9:21 ` Daniel Kiper
2017-02-28 17:41 ` Daniel Kiper
2017-02-28 17:58 ` Andrew Cooper
2017-02-28 19:01 ` Daniel Kiper
2017-02-28 19:09 ` Andrew Cooper
2017-02-28 19:21 ` Daniel Kiper
2017-03-01 8:02 ` Jan Beulich
2017-03-01 9:00 ` Daniel Kiper
2017-03-01 9:08 ` Jan Beulich
2017-03-01 9:44 ` Daniel Kiper
2017-02-28 15:54 ` [PATCH 1/2] x86/layout: Correct Xen's idea of its own memory layout Jan Beulich
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=1488295218-26057-1-git-send-email-andrew.cooper3@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=JBeulich@suse.com \
--cc=xen-devel@lists.xen.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).