xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Kiper <daniel.kiper@oracle.com>
To: xen-devel@lists.xenproject.org
Cc: andrew.cooper3@citrix.com, jbeulich@suse.com, konrad.wilk@oracle.com
Subject: [PATCH] x86/setup: do not relocate below the end of current Xen image placement
Date: Mon, 27 Nov 2017 16:41:03 +0100	[thread overview]
Message-ID: <1511797263-12887-1-git-send-email-daniel.kiper@oracle.com> (raw)

If it is possible we would like to have the Xen image higher than the
booloader put it and certainly do not overwrite the Xen code and data
during copy/relocation. Otherwise the Xen may crash silently at boot.

Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
---
 xen/arch/x86/setup.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 32bb02e..be91d34 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -960,7 +960,13 @@ void __init noreturn __start_xen(unsigned long mbi_p)
         }
         else
             end = 0;
-        if ( end > s )
+
+        /*
+         * Is the region size greater than zero?
+         * Does the region begins above or at the
+         * end of current Xen image placement?
+         */
+        if ( end > s && (end - reloc_size >= _end - _start) )
         {
             l4_pgentry_t *pl4e;
             l3_pgentry_t *pl3e;
-- 
1.7.10.4


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

             reply	other threads:[~2017-11-27 15:41 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-27 15:41 Daniel Kiper [this message]
2017-11-27 16:51 ` [PATCH] x86/setup: do not relocate below the end of current Xen image placement Jan Beulich
2017-11-28 12:41   ` Daniel Kiper
2017-11-28 14:28     ` Jan Beulich
2017-11-29 18:56       ` Daniel Kiper
2017-11-29 22:57         ` Daniel Kiper
2017-11-30  8:00         ` Jan Beulich
2017-11-27 16:58 ` Andrew Cooper
2017-11-27 19:54   ` Konrad Rzeszutek Wilk
2017-11-28  7:42     ` Jan Beulich
2017-11-28  7:37   ` Jan Beulich
2017-11-28 11:32   ` Daniel Kiper
2017-11-28 11:51     ` Jan Beulich
2017-11-28 12:47       ` Daniel Kiper
2017-11-28 13:37         ` Jan Beulich
2017-11-28 13:53           ` Daniel Kiper
2017-11-28 14:02             ` Jan Beulich
2017-11-28 14:27               ` Daniel Kiper

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=1511797263-12887-1-git-send-email-daniel.kiper@oracle.com \
    --to=daniel.kiper@oracle.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=konrad.wilk@oracle.com \
    --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).