From patchwork Thu Feb 25 14:56:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony PERARD X-Patchwork-Id: 8424211 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 3CE57C0553 for ; Thu, 25 Feb 2016 14:59:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8345320204 for ; Thu, 25 Feb 2016 14:59:51 +0000 (UTC) Received: from lists.xen.org (unknown [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B3153202B8 for ; Thu, 25 Feb 2016 14:59:50 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.84) (envelope-from ) id 1aYxLx-0001Xh-7C; Thu, 25 Feb 2016 14:57:17 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.84) (envelope-from ) id 1aYxLv-0001Ss-V8 for xen-devel@lists.xen.org; Thu, 25 Feb 2016 14:57:16 +0000 Received: from [193.109.254.147] by server-3.bemta-14.messagelabs.com id 96/64-03304-B461FC65; Thu, 25 Feb 2016 14:57:15 +0000 X-Env-Sender: prvs=85652c963=anthony.perard@citrix.com X-Msg-Ref: server-16.tower-27.messagelabs.com!1456412231!26664967!3 X-Originating-IP: [66.165.176.89] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni44OSA9PiAyMDMwMDc=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 7.35.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 13991 invoked from network); 25 Feb 2016 14:57:14 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-16.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 25 Feb 2016 14:57:14 -0000 X-IronPort-AV: E=Sophos;i="5.22,498,1449532800"; d="scan'208";a="334491068" From: Anthony PERARD To: Date: Thu, 25 Feb 2016 14:56:07 +0000 Message-ID: <1456412174-20162-10-git-send-email-anthony.perard@citrix.com> X-Mailer: git-send-email 2.7.1 In-Reply-To: <1456412174-20162-1-git-send-email-anthony.perard@citrix.com> References: <1456412174-20162-1-git-send-email-anthony.perard@citrix.com> MIME-Version: 1.0 X-DLP: MIA1 Cc: Keir Fraser , Stefano Stabellini , Andrew Cooper , Ian Jackson , Jan Beulich , Anthony PERARD , Wei Liu Subject: [Xen-devel] [PATCH v3 09/16] hvmloader: Check modules whereabouts 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-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,RDNS_NONE, UNPARSEABLE_RELAY autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP As perform_tests() is going to clear memory past 4MB, we check that the memory can be use. Signed-off-by: Anthony PERARD --- New in V3 --- tools/firmware/hvmloader/hvmloader.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tools/firmware/hvmloader/hvmloader.c b/tools/firmware/hvmloader/hvmloader.c index d319de0..a40503d 100644 --- a/tools/firmware/hvmloader/hvmloader.c +++ b/tools/firmware/hvmloader/hvmloader.c @@ -303,6 +303,15 @@ int main(void) smp_initialise(); + /* Check that tests does not use memory where modules are stored */ + BUG_ON( ((uint32_t)hvm_start_info + sizeof(struct hvm_start_info)) >= 4 << 20 ); + for ( unsigned i = 0; i < hvm_start_info->nr_modules; i++ ) + { + const struct hvm_modlist_entry *modlist = + (struct hvm_modlist_entry *)hvm_start_info->modlist_paddr; + if ( modlist[i].size ) + BUG_ON( modlist[i].paddr + modlist[i].size >= 4ul << 20 ); + } perform_tests(); if ( bios->bios_info_setup )