Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp7257540imm; Tue, 28 Aug 2018 08:53:38 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYv8nyyi6sV77SaMALC3jfLJLg95Ctd5fDe1gPVgAyl6znO+t51SZEe7jzx+T5J3wMdoirx X-Received: by 2002:a17:902:4601:: with SMTP id o1-v6mr2176440pld.202.1535471618459; Tue, 28 Aug 2018 08:53:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535471618; cv=none; d=google.com; s=arc-20160816; b=qW0ElBDpNAjNGYKX9rujSY5+pD9j1fSF1kze5Q57hUpGbmHiY4ytrdxS/7nIqScHVK szo/JL15+/LhGwqNlPWCQWH6846aGs8kzVUe3143ORTPPnBHcAeizThxoiy8yl5sAiv1 9toJebKMyQkVM0D2c3SYnfHlIWrQofmiBSb6iEysrzLwAiFMKbyVRwV+c3U4hucrBVYC Go0MFHCRIxYGA/qKNfWf3ckzOxzri3ADj5E068c8O+7BgY8IJeQnieH8oQI0aExHQ/rU okahjH65ULKIheHOKv1vfyD/3AqEjictqEUa8hioRWJxS1l6lv0e+shoh4S8PLq/1D5D vyZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=mbWqkD8EBRkPp76eAM52oUgN4ceEA5OTGSJX031UC3c=; b=N2Y+o7q1glxKeJcQ5CNzKgBIYn+W304X/rl5F1r9VvPbOQJGKhJ5LFc3rZzOhQVHN8 flMx3OuGF6nyp52PafdMFPRkKNzQP9QPKmlBut/VWyr2AoKH0e3ujipzb44cic4h0SuI 4z/uQyh1mX8S0r1oAB2TWaxgdIinoKgSUs71IgcvX7l91uy7RBt+p22sreiv8INSJTmE QuLiiRld3BVdu1P8k86/+xOblbfy+Wb5kDoZkrNEeRVL7elJJ+DBnaanDgEUA99BQsBy bttfazHOlh9551GqvWWCNBoAbRI6tDu4SE2IQYuAYxaOUhfsV4kmsNBE3ddfNNExh50h Ymgw== ARC-Authentication-Results: i=1; mx.google.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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h5-v6si1172930pls.188.2018.08.28.08.53.23; Tue, 28 Aug 2018 08:53: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; 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 S1727435AbeH1ToR (ORCPT + 99 others); Tue, 28 Aug 2018 15:44:17 -0400 Received: from foss.arm.com ([217.140.101.70]:40950 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726383AbeH1ToQ (ORCPT ); Tue, 28 Aug 2018 15:44:16 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 70542168F; Tue, 28 Aug 2018 08:52:00 -0700 (PDT) Received: from e112298-lin.Emea.Arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 78C983F557; Tue, 28 Aug 2018 08:51:58 -0700 (PDT) From: Julien Thierry To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, daniel.thompson@linaro.org, joel@joelfernandes.org, marc.zyngier@arm.com, mark.rutland@arm.com, christoffer.dall@arm.com, james.morse@arm.com, catalin.marinas@arm.com, will.deacon@arm.com, Julien Thierry Subject: [PATCH v5 05/27] arm64: Use daifflag_restore after bp_hardening Date: Tue, 28 Aug 2018 16:51:15 +0100 Message-Id: <1535471497-38854-6-git-send-email-julien.thierry@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1535471497-38854-1-git-send-email-julien.thierry@arm.com> References: <1535471497-38854-1-git-send-email-julien.thierry@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org For EL0 entries requiring bp_hardening, daif status is kept at DAIF_PROCCTX_NOIRQ until after hardening has been done. Then interrupts are enabled through local_irq_enable(). Before using local_irq_* functions, daifflags should be properly restored to a state where IRQs are enabled. Enable IRQs by restoring DAIF_PROCCTX state after bp hardening. Signed-off-by: Julien Thierry Cc: Catalin Marinas Cc: Will Deacon Cc: Mark Rutland Cc: James Morse --- arch/arm64/mm/fault.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c index 50b30ff..dfa2c43 100644 --- a/arch/arm64/mm/fault.c +++ b/arch/arm64/mm/fault.c @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include @@ -771,7 +772,7 @@ asmlinkage void __exception do_el0_ia_bp_hardening(unsigned long addr, if (addr > TASK_SIZE) arm64_apply_bp_hardening(); - local_irq_enable(); + local_daif_restore(DAIF_PROCCTX); do_mem_abort(addr, esr, regs); } @@ -785,7 +786,7 @@ asmlinkage void __exception do_sp_pc_abort(unsigned long addr, if (user_mode(regs)) { if (instruction_pointer(regs) > TASK_SIZE) arm64_apply_bp_hardening(); - local_irq_enable(); + local_daif_restore(DAIF_PROCCTX); } clear_siginfo(&info); -- 1.9.1