From patchwork Fri Mar 16 16:13:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 131932 Delivered-To: patch@linaro.org Received: by 10.46.84.17 with SMTP id i17csp939788ljb; Fri, 16 Mar 2018 09:13:39 -0700 (PDT) X-Google-Smtp-Source: AG47ELuCEgD66vRV5sNNrFgvJVhUwPIHUF+44dqgqHAlCp1ivfIyub3vxBW60i3Xc5hSDi0DYNnf X-Received: by 2002:a17:902:858c:: with SMTP id e12-v6mr2772414plo.39.1521216819484; Fri, 16 Mar 2018 09:13:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521216819; cv=none; d=google.com; s=arc-20160816; b=JDr/6ZvcwsclwciKW4VWMp85BmQfJ/GUy9hy1mA+IHrqQy/MD8f4dT41rAuS1M8dE4 rRtjtci3+Nvj650+VGkO1Q7/G8et5reME5FrjddwaL5+/eUXZgFfiaS20O090MVpsDXQ 2fzf48M0kCViJeAP1EHRxbQzS/jf4ENaYo2bxPKba6fxqiLRNlSN628RZVvwq/Ym0i9A ahyqZkSDe8SH9qstUMCKaamu1ErNQLZGWRNOWnxqXXfiYa8EqwhfD+4QgiBnxpns3uBP 78zTJxEwkyIAkZch+ZOOo+59Ts9b2V5UX9neng3wc9wY3k9R/8pjbVrbu+3aq5QVF9Cp z4zA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=7f36Y8719UueeMPyDnFU54KtPzGCOquQZcOGO+krYQA=; b=VKognzmyJB0Nbi4oMkJ30hDx6pW3iQBx0rSL/KqXjmkuViZqzg7Yme7NBmqMQe4U6b 9nMaSlWiP/g2ciibHsqWeYfQha3OAVNwmirlvX6T8kPvT0lVhOXxMiNlEeMmtH/dQwrK 3EllivkDVT7fBGAUXRuihjUmmTIeVrGbR9zwId/Nrd6ndy79Ncgpm8zT+mXeD53OW+6l K+JmXAmVLKInrkiGSZZuw/DSeweB1yM8DVqJ84gC4965iO9bXVftF7oOKzZ1QhzDc0Vs RoWY1PKuVlTW10tQ0PcfSZHJ4fzBXYWUlB9kpvk18qtUORrnCs+7wpzUoqMD/JQk9s0r utoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=C/sIPMqB; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id 13-v6si6451116ple.157.2018.03.16.09.13.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Mar 2018 09:13:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=C/sIPMqB; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id CA255223CDC1D; Fri, 16 Mar 2018 09:07:11 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c0c::243; helo=mail-wr0-x243.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wr0-x243.google.com (mail-wr0-x243.google.com [IPv6:2a00:1450:400c:c0c::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id E5F6020956060 for ; Fri, 16 Mar 2018 09:07:09 -0700 (PDT) Received: by mail-wr0-x243.google.com with SMTP id v65so12209017wrc.11 for ; Fri, 16 Mar 2018 09:13:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=UP79KEtGjrsXu1BisqMygG3vBJQhUaVzyXwNOgD7MbY=; b=C/sIPMqBPcErrjKd5l9y049N4UtUdMd2LrK/rW5w6L738aVe9f4vjNjuVBYbilF2wF tWPeMTnANHt5If5Ij6vgzLXAliQe/9JQiFxhJ6ix6mfc1mayhAiFQgglsrdepToOBM/a DS3r8dUeKO+p58tDqLBKTip7ACsVwSBNBH7UE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=UP79KEtGjrsXu1BisqMygG3vBJQhUaVzyXwNOgD7MbY=; b=EcmFbCadx6yJrxf1Rj6HBnUJOE+UGSy8VLMc9bzQO67CUN+7LDKB72QDCMQiMUgFDP ysYsP1bGvV9T0qsoGG1bcTQ2G2QZd+AQm7SKpn6nxXL4p2+yCRwmH0xAN1NAHl7xYEFQ fh9XspRCsy4LN4seWI0a/DBcPI8Rz+bTrhrR1iY/N+0nVPl8tt8lSCWIsHdTzaeENjGc 7AjoAX8BhCq2nPKuXfdFY4h3x9cjZRHiXJ5Z4M3jZzWkLz0tdKkhZy4y+noo9fiCv8Lj 7nOscUwoXnsbA7YdPzUHyMgGilWMpA9yYRTB83Vg5/4yxdrskSw5H6WTYHJSe+2wJmm9 V5tQ== X-Gm-Message-State: AElRT7GTeaWzP7rySnViOSQQOk8ZkotA2lEXRAcvqDnWxuMjwjEkwNfS Be3vztN+RCbKjHEk/okeqdH+PZlt/uc= X-Received: by 10.223.136.183 with SMTP id f52mr2060331wrf.74.1521216813491; Fri, 16 Mar 2018 09:13:33 -0700 (PDT) Received: from localhost.localdomain ([105.142.191.63]) by smtp.gmail.com with ESMTPSA id n8sm7876242wrf.12.2018.03.16.09.13.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Mar 2018 09:13:32 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Fri, 16 Mar 2018 16:13:18 +0000 Message-Id: <20180316161322.6756-3-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180316161322.6756-1-ard.biesheuvel@linaro.org> References: <20180316161322.6756-1-ard.biesheuvel@linaro.org> Subject: [edk2] [RFC PATCH edk2-platforms 2/6] Silicon/SynQuacerPlatformFlashAccessLib: don't dereference FVB header fields X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: leif.lindholm@linaro.org, Ard Biesheuvel MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" When we updated the capsule definition to cover the ARM Trusted Firmware binary image as well as the firmware volume containing the EDK2 code, we failed to recognize that the start of the image no longer constitutes a Firmware Volume header, and so we should not interpret the data as such. Note that this makes the FVB protocol slighty less appropriate as the abstraction to use to write this data, but given that there does not appear to be a better match (disk I/O, block I/O), let's stick with it for now, but require the base address to match the capsule's target address exactly rather than reading the size of the FV from the header. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel --- Silicon/Socionext/SynQuacer/Library/SynQuacerPlatformFlashAccessLib/SynQuacerPlatformFlashAccessLib.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) -- 2.15.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/Silicon/Socionext/SynQuacer/Library/SynQuacerPlatformFlashAccessLib/SynQuacerPlatformFlashAccessLib.c b/Silicon/Socionext/SynQuacer/Library/SynQuacerPlatformFlashAccessLib/SynQuacerPlatformFlashAccessLib.c index 1af4abc16aa5..82fe3f74aa7f 100644 --- a/Silicon/Socionext/SynQuacer/Library/SynQuacerPlatformFlashAccessLib/SynQuacerPlatformFlashAccessLib.c +++ b/Silicon/Socionext/SynQuacer/Library/SynQuacerPlatformFlashAccessLib/SynQuacerPlatformFlashAccessLib.c @@ -53,7 +53,6 @@ GetFvbByAddress ( UINTN HandleCount; UINTN Index; EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *Fvb; - EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader; EFI_FVB_ATTRIBUTES_2 Attributes; // @@ -103,8 +102,7 @@ GetFvbByAddress ( continue; } - FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER *) ((UINTN) *FvbBaseAddress); - if ((Address >= *FvbBaseAddress) && (Address <= (*FvbBaseAddress + FwVolHeader->FvLength))) { + if (Address == *FvbBaseAddress) { *OutFvb = Fvb; Status = EFI_SUCCESS; break;