All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jan Beulich" <JBeulich@suse.com>
To: xen-devel <xen-devel@lists.xenproject.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Subject: [PATCH 3/3] x86/EFI: don't accept 64-bit base relocations on page tables
Date: Fri, 19 Aug 2016 01:52:04 -0600	[thread overview]
Message-ID: <57B6D6C40200007800107465@prv-mh.provo.novell.com> (raw)
In-Reply-To: <57B6D3C3020000780010743E@prv-mh.provo.novell.com>

[-- Attachment #1: Type: text/plain, Size: 1266 bytes --]

Page tables get pre-populated with physical addresses which, due to
living inside the Xen image, will never exceed 32 bits in width. That
in turn results in the tool generating the relocations to produce
32-bit relocations for them instead of the 64-bit ones needed for
relocating virtual addresses. Hence instead of special casing page
tables in the processing of 64-bit relocations, let's be more rigid
and refuse them (as being indicative of something else having gone
wrong in the build process).

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/arch/x86/efi/efi-boot.h
+++ b/xen/arch/x86/efi/efi-boot.h
@@ -81,12 +81,9 @@ static void __init efi_arch_relocate_ima
                 }
                 break;
             case PE_BASE_RELOC_DIR64:
-                if ( delta )
-                {
-                    *(u64 *)addr += delta;
-                    if ( in_page_tables(addr) )
-                        *(intpte_t *)addr += xen_phys_start;
-                }
+                if ( in_page_tables(addr) )
+                    blexit(L"Unexpected relocation type");
+                *(u64 *)addr += delta;
                 break;
             default:
                 blexit(L"Unsupported relocation type");




[-- Attachment #2: x86-EFI-64bit-reloc-pgtab.patch --]
[-- Type: text/plain, Size: 1324 bytes --]

x86/EFI: don't accept 64-bit base relocations on page tables

Page tables get pre-populated with physical addresses which, due to
living inside the Xen image, will never exceed 32 bits in width. That
in turn results in the tool generating the relocations to produce
32-bit relocations for them instead of the 64-bit ones needed for
relocating virtual addresses. Hence instead of special casing page
tables in the processing of 64-bit relocations, let's be more rigid
and refuse them (as being indicative of something else having gone
wrong in the build process).

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/arch/x86/efi/efi-boot.h
+++ b/xen/arch/x86/efi/efi-boot.h
@@ -81,12 +81,9 @@ static void __init efi_arch_relocate_ima
                 }
                 break;
             case PE_BASE_RELOC_DIR64:
-                if ( delta )
-                {
-                    *(u64 *)addr += delta;
-                    if ( in_page_tables(addr) )
-                        *(intpte_t *)addr += xen_phys_start;
-                }
+                if ( in_page_tables(addr) )
+                    blexit(L"Unexpected relocation type");
+                *(u64 *)addr += delta;
                 break;
             default:
                 blexit(L"Unsupported relocation type");

[-- Attachment #3: Type: text/plain, Size: 127 bytes --]

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

  parent reply	other threads:[~2016-08-19  7:52 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-19  7:39 [PATCH 0/3] x86/EFI: boot adjustments Jan Beulich
2016-08-19  7:50 ` [PATCH 1/3] x86/EFI: don't apply relocations to l{2, 3}_bootmap Jan Beulich
2016-08-19 10:34   ` Andrew Cooper
2016-08-19 12:05     ` Jan Beulich
2016-08-19  7:51 ` [PATCH 2/3] x86/EFI: be cautious about being handed control with CR4.PGE enabled Jan Beulich
2016-08-19 12:26   ` Andrew Cooper
2016-08-19  7:52 ` Jan Beulich [this message]
2016-08-19 12:39   ` [PATCH 3/3] x86/EFI: don't accept 64-bit base relocations on page tables Andrew Cooper
2016-08-19 12:57     ` Jan Beulich
2016-08-30 16:35       ` Andrew Cooper
2016-08-31 12:28         ` Jan Beulich
2016-08-31 12:32           ` Andrew Cooper
2016-08-31 13:03             ` Jan Beulich
2016-08-30 16:18   ` Ping: " 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=57B6D6C40200007800107465@prv-mh.provo.novell.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.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 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.