From patchwork Thu Jun 27 09:33:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Roger_Pau_Monn=C3=A9?= X-Patchwork-Id: 11019217 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CF03314E5 for ; Thu, 27 Jun 2019 09:35:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B4C6F28A5D for ; Thu, 27 Jun 2019 09:35:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A900728A81; Thu, 27 Jun 2019 09:35:10 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, 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 AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 960A128A6E for ; Thu, 27 Jun 2019 09:35:09 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hgQmt-0000k9-4c; Thu, 27 Jun 2019 09:33:51 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hgQms-0000k2-1v for xen-devel@lists.xenproject.org; Thu, 27 Jun 2019 09:33:50 +0000 X-Inumbo-ID: aa50da86-98be-11e9-8980-bc764e045a96 Received: from esa2.hc3370-68.iphmx.com (unknown [216.71.145.153]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id aa50da86-98be-11e9-8980-bc764e045a96; Thu, 27 Jun 2019 09:33:48 +0000 (UTC) Authentication-Results: esa2.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=roger.pau@citrix.com; spf=Pass smtp.mailfrom=roger.pau@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: None (esa2.hc3370-68.iphmx.com: no sender authenticity information available from domain of roger.pau@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa2.hc3370-68.iphmx.com; envelope-from="roger.pau@citrix.com"; x-sender="roger.pau@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa2.hc3370-68.iphmx.com: domain of roger.pau@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa2.hc3370-68.iphmx.com; envelope-from="roger.pau@citrix.com"; x-sender="roger.pau@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ~all" Received-SPF: None (esa2.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa2.hc3370-68.iphmx.com; envelope-from="roger.pau@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: YZOual/pYzxgWqz6QoUae+MRtkjx7N0pSU+hveaMHxG3udSgyNRKe2yjFXTaPZGQ9aMpJDdW2Y ZjrHAR87Te3QEj3V7VnF7pL11c2KabFfUXZmP3KijPOEz8DNoVj0F+ujmKamK5b56p+y3tF2CQ LvVTT2YC4PSTlVBSz0CniesPgZh7jrUmsFfLZX24JwD6KM8VrtQu/dhrL03yZqnEkxQ+8Y7dPz onEWxGUf/0j+om88gDzx6azsLPpiAAPz/5lEb70Lg2iHhbxJu47Zf3SirWWu8WeysVuICtbr2H HVE= X-SBRS: 2.7 X-MesageID: 2289985 X-Ironport-Server: esa2.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.63,423,1557201600"; d="scan'208";a="2289985" From: Roger Pau Monne To: Date: Thu, 27 Jun 2019 11:33:35 +0200 Message-ID: <20190627093335.56355-3-roger.pau@citrix.com> X-Mailer: git-send-email 2.20.1 (Apple Git-117) In-Reply-To: <20190627093335.56355-1-roger.pau@citrix.com> References: <20190627093335.56355-1-roger.pau@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v3 3/3] x86: check for multiboot{1, 2} header presence X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Andrew Cooper , Wei Liu , Jan Beulich , Roger Pau Monne Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP After building the hypervisor binary. Note that the check is performed by searching for the magic header value at the start of the binary. Signed-off-by: Roger Pau Monné Acked-by: Jan Beulich --- Cc: Jan Beulich Cc: Andrew Cooper Cc: Wei Liu --- Changes since v2: - Use a variable to store the intermediate file name. - Remove the intermediate file in the clean target. - Add intermediate file to gitignore. Changes since v1: - Use an intermediate file to perform the header checks. --- .gitignore | 1 + xen/arch/x86/Makefile | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index a77cbff02c..56bcb64837 100644 --- a/.gitignore +++ b/.gitignore @@ -278,6 +278,7 @@ tools/xentrace/xentrace xen/.banner xen/.config xen/.config.old +xen/.xen xen/System.map xen/arch/x86/asm-macros.i xen/arch/x86/boot/mkelf32 diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile index 8a8d8f060f..94e6c9aee3 100644 --- a/xen/arch/x86/Makefile +++ b/xen/arch/x86/Makefile @@ -99,9 +99,14 @@ endif syms-warn-dup-y := --warn-dup syms-warn-dup-$(CONFIG_SUPPRESS_DUPLICATE_SYMBOL_WARNINGS) := +$(TARGET): TMP = $(@D)/.$(@F) $(TARGET): $(TARGET)-syms $(efi-y) boot/mkelf32 - ./boot/mkelf32 $(notes_phdrs) $(TARGET)-syms $(TARGET) $(XEN_IMG_OFFSET) \ + ./boot/mkelf32 $(notes_phdrs) $(TARGET)-syms $(TMP) $(XEN_IMG_OFFSET) \ `$(NM) $(TARGET)-syms | sed -ne 's/^\([^ ]*\) . __2M_rwdata_end$$/0x\1/p'` + # Check for multiboot{1,2} headers + od -t x4 -N 8192 $(TMP) | grep 1badb002 > /dev/null + od -t x4 -N 32768 $(TMP) | grep e85250d6 > /dev/null + mv $(TMP) $(TARGET) ALL_OBJS := $(BASEDIR)/arch/x86/boot/built_in.o $(BASEDIR)/arch/x86/efi/built_in.o $(ALL_OBJS) @@ -249,7 +254,7 @@ efi/mkreloc: efi/mkreloc.c clean:: rm -f asm-offsets.s *.lds boot/*.o boot/*~ boot/core boot/mkelf32 rm -f asm-macros.i $(BASEDIR)/include/asm-x86/asm-macros.* - rm -f $(BASEDIR)/.xen-syms.[0-9]* boot/.*.d + rm -f $(BASEDIR)/.xen-syms.[0-9]* boot/.*.d $(BASEDIR)/.xen rm -f $(BASEDIR)/.xen.efi.[0-9]* efi/*.efi efi/mkreloc rm -f boot/cmdline.S boot/reloc.S boot/*.lnk boot/*.bin rm -f note.o