From patchwork Fri Aug 19 07:52:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 9289749 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 867DC60574 for ; Fri, 19 Aug 2016 07:54:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 79F9829126 for ; Fri, 19 Aug 2016 07:54:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6ED882932B; Fri, 19 Aug 2016 07:54:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 493B329126 for ; Fri, 19 Aug 2016 07:54:13 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1baeb1-0005nI-Ui; Fri, 19 Aug 2016 07:52:07 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1baeb0-0005n2-F7 for xen-devel@lists.xenproject.org; Fri, 19 Aug 2016 07:52:06 +0000 Received: from [193.109.254.147] by server-10.bemta-6.messagelabs.com id CB/A2-27438-5AAB6B75; Fri, 19 Aug 2016 07:52:05 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrDIsWRWlGSWpSXmKPExsXS6fjDS3fJrm3 hBue/Glt83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBnvG96yFfyRqHi69gl7A+NaoS5GTg4hgTyJ Vcu2sYHYvAJ2Eu839TKD2BIChhJP318Hi7MIqEpMuNcGZrMJqEu0PdvO2sXIwSEiYCBx7mgSi MksoC+xbR0LSIWwQJDE1rWNLBDT7STmXf7MBGJzCthLTFy6gB2knFdAUOLvDmGQMDNQya7XF5 kmMPLMQsjMQpKBsLUkHv66xQJha0ssW/iaeRbYXmmJ5f84IMIOErtmPWNGVQJie0s0vjnBuIC RYxWjRnFqUVlqka6hpV5SUWZ6RkluYmaOrqGBmV5uanFxYnpqTmJSsV5yfu4mRmCoMgDBDsYf ywIOMUpyMCmJ8v7S3xYuxJeUn1KZkVicEV9UmpNafIhRhoNDSYJXYCdQTrAoNT21Ii0zBxg1M GkJDh4lEV45kDRvcUFibnFmOkTqFKOilDjvrR1ACQGQREZpHlwbLFIvMcpKCfMyAh0ixFOQWp SbWYIq/4pRnINRSZhXHmQ8T2ZeCdz0V0CLmYAW8/JvAVlckoiQkmpgVKsXfFEw83mplxtj8+9 fW1wyy+OZXkW+WeJUI9Vob1Bf4uTw5K6Mr4owT4DiJllzltvvortnHHi+Z0bftuWnnXiW7786 TankZ5/OJ9V9l84mL1SZ2/Zl5twLyfsTp9o9nx3jlBegvbZJQbhHy/dZuZTt5kOTlfYUzOJM5 w5Imzf5fahahHySEktxRqKhFnNRcSIAc9TyiM8CAAA= X-Env-Sender: JBeulich@suse.com X-Msg-Ref: server-7.tower-27.messagelabs.com!1471593122!50085460!1 X-Originating-IP: [137.65.248.74] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.84; banners=-,-,- X-VirusChecked: Checked Received: (qmail 31606 invoked from network); 19 Aug 2016 07:52:04 -0000 Received: from prv-mh.provo.novell.com (HELO prv-mh.provo.novell.com) (137.65.248.74) by server-7.tower-27.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 19 Aug 2016 07:52:04 -0000 Received: from INET-PRV-MTA by prv-mh.provo.novell.com with Novell_GroupWise; Fri, 19 Aug 2016 01:52:02 -0600 Message-Id: <57B6D6C40200007800107465@prv-mh.provo.novell.com> X-Mailer: Novell GroupWise Internet Agent 14.2.1 Date: Fri, 19 Aug 2016 01:52:04 -0600 From: "Jan Beulich" To: "xen-devel" References: <57B6D3C3020000780010743E@prv-mh.provo.novell.com> In-Reply-To: <57B6D3C3020000780010743E@prv-mh.provo.novell.com> Mime-Version: 1.0 Cc: Andrew Cooper Subject: [Xen-devel] [PATCH 3/3] x86/EFI: don't accept 64-bit base relocations on page tables X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 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 --- 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"); --- 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");