From patchwork Mon Apr 25 20:07:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Fleming X-Patchwork-Id: 66618 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp1233816qge; Mon, 25 Apr 2016 13:09:38 -0700 (PDT) X-Received: by 10.66.162.39 with SMTP id xx7mr50912797pab.97.1461614978143; Mon, 25 Apr 2016 13:09:38 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w11si8609031pag.49.2016.04.25.13.09.37; Mon, 25 Apr 2016 13:09:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeblueprint-co-uk.20150623.gappssmtp.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965093AbcDYUIg (ORCPT + 29 others); Mon, 25 Apr 2016 16:08:36 -0400 Received: from mail-wm0-f50.google.com ([74.125.82.50]:37418 "EHLO mail-wm0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933434AbcDYUI3 (ORCPT ); Mon, 25 Apr 2016 16:08:29 -0400 Received: by mail-wm0-f50.google.com with SMTP id n3so145618550wmn.0 for ; Mon, 25 Apr 2016 13:08:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=codeblueprint-co-uk.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=NvrFADUkh/dhUulkcmpi1CqVCS+xKBWUlRfrVMo6+rE=; b=tqblPl6aYWLkpJXb2yGUWGBpkODrDAq+Qt4nS/HpGyj8Fv2TlDUP8m8E2d7sEohZMq zAh3Gj94OziwVk+P9tPt7krvLOGsOOxKbKDuCRdSauzE53NJRp5mnd4qH7sf59yIlMn4 KFOG3Je7HnbAtHyj5V7xklbdzciwZgdAdWg43QSJwhEsNKKOtBUsEIs+Fm8UsVWmzoj1 JIhDRxe1o3BAizxYOcEcl1qeW0eVmvNC/3mOxm2HHwCeWQqDU/j/hcUMPTZNymzBMXF6 Ir2RNaVyInf/HDYEZUG+aLz02x6QtqL6ukshLt0kszgV2Enh7TheZuBTnDGwO70TKHun sb0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=NvrFADUkh/dhUulkcmpi1CqVCS+xKBWUlRfrVMo6+rE=; b=CT68AhX5oYpNPez/F5A1gble9+tjTE92p5nsQ8g0iwJX/z/HnDmp5jepHzDuUV9RIO pxgdSY3oe82VxZGkkTJZ6uCG3MjvF1vC/me8/Yj805SKcMv7k1Q68aRFGg/PyAysyeYp gz49uHUPwnToC/sbl6Sa+iQBZpiFHVP4by5JsnvfvoFaXHXZld78cvIDtPri0jhQpmTu Xy2qWJd9Dc9Ovi7GH+W8gwX5R94kvy29OOxI2CE8Af0KN1rUt8vUH0rXbRRdTfCbcKNB NTK7hYeJIKrc1lId3QPBo1/3LqUKsN7JQ+qKa6ZLsHJapOob2xi6rlu5LFep8Hhd/hEr C5lQ== X-Gm-Message-State: AOPr4FXXjDsc248opkfInJZUmlvH6DG0HkjW+MF7ypa0jaoZbjhpU/JdVNcwjWV0W0x9Nw== X-Received: by 10.28.20.198 with SMTP id 189mr14255565wmu.103.1461614908373; Mon, 25 Apr 2016 13:08:28 -0700 (PDT) Received: from localhost (bcdc58e5.skybroadband.com. [188.220.88.229]) by smtp.gmail.com with ESMTPSA id v143sm20276084wmv.4.2016.04.25.13.08.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Apr 2016 13:08:27 -0700 (PDT) From: Matt Fleming To: Ingo Molnar , Thomas Gleixner , "H . Peter Anvin" Cc: Mark Rutland , Ard Biesheuvel , linux-kernel@vger.kernel.org, linux-efi@vger.kernel.org, Matt Fleming , Catalin Marinas , Colin Ian King , Leif Lindholm , Russell King , Will Deacon Subject: [PATCH 38/40] arm/efi: Enable runtime call flag checking Date: Mon, 25 Apr 2016 21:07:10 +0100 Message-Id: <1461614832-17633-39-git-send-email-matt@codeblueprint.co.uk> X-Mailer: git-send-email 2.7.3 In-Reply-To: <1461614832-17633-1-git-send-email-matt@codeblueprint.co.uk> References: <1461614832-17633-1-git-send-email-matt@codeblueprint.co.uk> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mark Rutland Define ARCH_EFI_IRQ_FLAGS_MASK for arm, which will enable the generic runtime wrapper code to detect when firmware erroneously modifies flags over a runtime services function call. We check all allocated flags, barring those which firmware has legitimate reason to modify (condition flags and IT state). While in practice corruption of some flags (e.g. J) would already be fatal, we include these for consistency and documentation purposes. Signed-off-by: Mark Rutland Cc: Ard Biesheuvel Cc: Leif Lindholm Cc: Russell King Cc: linux-arm-kernel@lists.infradead.org Cc: linux-efi@vger.kernel.org Cc: Catalin Marinas Cc: "H. Peter Anvin" Cc: Thomas Gleixner Cc: Will Deacon Cc: Colin Ian King Signed-off-by: Matt Fleming --- arch/arm/include/asm/efi.h | 5 +++++ 1 file changed, 5 insertions(+) -- 2.7.3 diff --git a/arch/arm/include/asm/efi.h b/arch/arm/include/asm/efi.h index 5f273b43d704..a708fa1f0905 100644 --- a/arch/arm/include/asm/efi.h +++ b/arch/arm/include/asm/efi.h @@ -17,6 +17,7 @@ #include #include #include +#include #ifdef CONFIG_EFI void efi_init(void); @@ -34,6 +35,10 @@ int efi_set_mapping_permissions(struct mm_struct *mm, efi_memory_desc_t *md); __f(args); \ }) +#define ARCH_EFI_IRQ_FLAGS_MASK \ + (PSR_J_BIT | PSR_E_BIT | PSR_A_BIT | PSR_I_BIT | PSR_F_BIT | \ + PSR_T_BIT | MODE_MASK) + static inline void efi_set_pgd(struct mm_struct *mm) { check_and_switch_context(mm, NULL);