From patchwork Wed Apr 5 09:23:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 96792 Delivered-To: patch@linaro.org Received: by 10.140.89.233 with SMTP id v96csp173367qgd; Wed, 5 Apr 2017 02:23:45 -0700 (PDT) X-Received: by 10.98.142.26 with SMTP id k26mr14301290pfe.30.1491384225395; Wed, 05 Apr 2017 02:23:45 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y73si20044853pgd.394.2017.04.05.02.23.45; Wed, 05 Apr 2017 02:23:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-efi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933067AbdDEJX3 (ORCPT + 2 others); Wed, 5 Apr 2017 05:23:29 -0400 Received: from mail-wm0-f44.google.com ([74.125.82.44]:37880 "EHLO mail-wm0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932632AbdDEJX1 (ORCPT ); Wed, 5 Apr 2017 05:23:27 -0400 Received: by mail-wm0-f44.google.com with SMTP id x124so8370937wmf.0 for ; Wed, 05 Apr 2017 02:23:27 -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; bh=UkgAUCZabfoD+T83xfK7GOSF0OdZ+3SiXeY08jKkuJ4=; b=IHQ6sXDL200ftSMwAyNSe3yuEFDeo2fkl7/KSP4tezAPtLlbHZL4owJgTkc6uFCGM7 owunIWrlPVyJX5KtCoh69vB6A81xsuyVgfh6skzpsMlmx6fIAxeZogSccvIOr3qqtBdK sdOqijShVogukSUGrajIYSu5ehk6TYJPVExgY= 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; bh=UkgAUCZabfoD+T83xfK7GOSF0OdZ+3SiXeY08jKkuJ4=; b=OviZ7fLHDMLrsn9xPQX3h9Y0rrCk4rpI5p8uGb171xTvUn2mfaGd6E9YLF5Gh8huJT 5mFYIftArgC2Ubi0W9gYaJUHnIFEslLM6R3gODnbyDMS/6gWvlTEsqnExA87vnWbkOSO kHNbzjTE0nFPr4f+69/yAwEJQIDYLNEnxmrvz/mS+zP27Wn9NjZuLURdPwZoPIFTf2ev PIWey4QLig6H2B537QzQnO84JSRmJJtu5EjXXQdE68hLURAAdDwFSh/NFmwhsh5UhW21 sOrQH8/ycR2s5mX32z0l53eut/y1wq6+KnYCMMrzUIdRya0kiV+jXnZ5O5ssnjHAJBLI eoOg== X-Gm-Message-State: AFeK/H3+qaetUfDx0gYaf2PTgHqOGYvwtWk0j/M5RRZMXECvomJjbujW TMwapxM23cHIyixv X-Received: by 10.28.109.93 with SMTP id i90mr18204224wmc.44.1491384206225; Wed, 05 Apr 2017 02:23:26 -0700 (PDT) Received: from localhost.localdomain ([160.163.145.113]) by smtp.gmail.com with ESMTPSA id b66sm23935271wrd.29.2017.04.05.02.23.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Apr 2017 02:23:25 -0700 (PDT) From: Ard Biesheuvel To: linux-efi@vger.kernel.org Cc: matt@codeblueprint.co.uk, andy.shevchenko@gmail.com, pure.logic@nexus-software.ie, hock.leong.kweh@intel.com, bp@alien8.de, sascha.weisenberger@siemens.com, jan.kiszka@siemens.com, Ard Biesheuvel Subject: [PATCH 0/8] efi: add support for non-standard capsule headers Date: Wed, 5 Apr 2017 10:23:09 +0100 Message-Id: <20170405092317.27921-1-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.9.3 Sender: linux-efi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org This is a followup to Jan's series [0] to add support for the non-standard and awkward capsule header layout that is used by the Quark platform. While we would prefer to adhere to the standard rigorously, the reality (and common practice) in Linux is that we sometimes have to deal with quirks. So while Jan's aim is to get Quark to work, the reason for my involvement is to try and accommodate this in a flexible way without putting any handling specific to this quirk in the common code. Patches #1 to #4 are minor preparatory cleanups. Patch #5 reworks the capsule loader code to use a cached copy of the header rather than load it from memory multiple times (which may involve a kmap/kunmap sequence if it is in highmem). This also allows some mangling to be performed by quirks code. Patch #6 splits up efi_capsule_setup_info() into a primary part called __efi_capsule_setup_info(), and a __weak wrapper under the original name, allowing it to be overridden externally. Patch #7 changes the array of struct page pointers maintained by the capsule loader into an array of physical addresses. This allows special versions of efi_capsule_setup_info() to mangle the contents of the capsule (and skip headers by moving pointers around) without putting any intimate knowledge of the quirks handling into the common code. Patch #8 is Jan's original patch to add the Quark specific quirk to arch/x86, but reworked to take advantage of the facilities added in #6 and #7. This has been tested by Jan on Quark, but this needs testing on other platforms to ensure that the common code still works as expected on conforming firmware implementations. Ard Biesheuvel (3): efi/capsule-loader: use cached copy of capsule header efi/capsule-loader: indirect calls to efi_capsule_setup_info via weak alias efi/capsule-loader: use page addresses rather than struct page pointers Jan Kiszka (5): efi/capsule: Fix return code on failing kmap/vmap efi/capsule: Remove pr_debug on ENOMEM or EFAULT efi/capsule: Clean up pr_err/info messages efi/capsule: Adjust return type of efi_capsule_setup_info efi/capsule: Add support for Quark security header arch/x86/platform/efi/quirks.c | 112 ++++++++++++++++++++ drivers/firmware/efi/Kconfig | 9 ++ drivers/firmware/efi/capsule-loader.c | 111 ++++++++----------- drivers/firmware/efi/capsule.c | 7 +- include/linux/efi.h | 14 ++- 5 files changed, 184 insertions(+), 69 deletions(-) -- 2.9.3 -- To unsubscribe from this list: send the line "unsubscribe linux-efi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Tested-by: Bryan O'Donoghue