Received: by 10.223.185.116 with SMTP id b49csp2242498wrg; Thu, 15 Feb 2018 08:37:56 -0800 (PST) X-Google-Smtp-Source: AH8x225pfEY34i/e1ZW8tSKYsyGfi+i/qSuIHLLczkvwrb3/K40PZ9M9h33EEZbTCg+9LgB99ckc X-Received: by 10.99.174.69 with SMTP id e5mr2676293pgp.269.1518712676022; Thu, 15 Feb 2018 08:37:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518712675; cv=none; d=google.com; s=arc-20160816; b=rz+3hija3Akj1DJHbyCD8t/iedmfIeddOAnozmHm4o/ZQJssQc79wuas2Yl1SdEEjx BvX2SDlA+ge7OneT8oEg3uyQcAIUNIkkYngt9uIkefjGswl/ZQDKXiFnxwpPAYy8obLP wwpn0bww+E4s0J3A+MkjKsamRnK+75eK0qmNa/RZimPoPz66Ug4ilzfgiW/ClPfGbFM5 +fW7erC/d/9f2/FeQMNa9eUvQgBL3LitYeQiO1ZgpXQ7K5cFVKyA/Q7zUS4YbHxOA5Co rJTG5eGHNeVQlLu91PVYXG4Irwa8mKeVtJNilKodsg5s37wW6FHLNlPtijs7WCDGO0Z5 OA5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=TZ8bOAQ/xtX038d5Jo1nur5apODGqnyju8efPEenH70=; b=ilyuomCKkuEh4d5lTcuZF/KUU4Ehqw9uX8EmvMOKIBt8FcJ4iEiy2lqMBDh+WjcVp9 jKCDr/W2qcAeheSsPYTLtSrbKWtOl8PF5BJO1uBfVd4qFOYgQMEZaYennB8+MfNM3ByG ryc5Ies5H3Wf7EZ62gZCci1oGfwTwbP3UYEoHO449WcgSgcBMybDXPYo41WIEKTvYd3y jVREvkWLxJdStasg5MEIFR4yUjFCPBtCInKQkFWbv23qmQiM27fzIggsVZOzMYBb1iwa gHp763szsZh10GFs6I9CBoXhDf1h0TFa20Z4BtgbfjXbcDLrWlG1/jeBzm2dhRsyOZAN pbig== 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 h8si436692pgf.418.2018.02.15.08.37.40; Thu, 15 Feb 2018 08:37:55 -0800 (PST) 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 S1423976AbeBOPlf (ORCPT + 99 others); Thu, 15 Feb 2018 10:41:35 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:60832 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1423947AbeBOPld (ORCPT ); Thu, 15 Feb 2018 10:41:33 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id ADD17D5B; Thu, 15 Feb 2018 15:41:32 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Hettena , Marc Zyngier , Will Deacon , Catalin Marinas Subject: [PATCH 4.15 066/202] [Variant 2/Spectre-v2] arm64: entry: Apply BP hardening for high-priority synchronous exceptions Date: Thu, 15 Feb 2018 16:16:06 +0100 Message-Id: <20180215151716.907352807@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180215151712.768794354@linuxfoundation.org> References: <20180215151712.768794354@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Will Deacon Commit 5dfc6ed27710 upstream. Software-step and PC alignment fault exceptions have higher priority than instruction abort exceptions, so apply the BP hardening hooks there too if the user PC appears to reside in kernel space. Reported-by: Dan Hettena Reviewed-by: Marc Zyngier Signed-off-by: Will Deacon Signed-off-by: Catalin Marinas Signed-off-by: Greg Kroah-Hartman --- arch/arm64/kernel/entry.S | 5 ++++- arch/arm64/mm/fault.c | 9 +++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) --- a/arch/arm64/kernel/entry.S +++ b/arch/arm64/kernel/entry.S @@ -767,7 +767,10 @@ el0_sp_pc: * Stack or PC alignment exception handling */ mrs x26, far_el1 - enable_daif + enable_da_f +#ifdef CONFIG_TRACE_IRQFLAGS + bl trace_hardirqs_off +#endif ct_user_exit mov x0, x26 mov x1, x25 --- a/arch/arm64/mm/fault.c +++ b/arch/arm64/mm/fault.c @@ -731,6 +731,12 @@ asmlinkage void __exception do_sp_pc_abo struct siginfo info; struct task_struct *tsk = current; + if (user_mode(regs)) { + if (instruction_pointer(regs) > TASK_SIZE) + arm64_apply_bp_hardening(); + local_irq_enable(); + } + if (show_unhandled_signals && unhandled_signal(tsk, SIGBUS)) pr_info_ratelimited("%s[%d]: %s exception: pc=%p sp=%p\n", tsk->comm, task_pid_nr(tsk), @@ -790,6 +796,9 @@ asmlinkage int __exception do_debug_exce if (interrupts_enabled(regs)) trace_hardirqs_off(); + if (user_mode(regs) && instruction_pointer(regs) > TASK_SIZE) + arm64_apply_bp_hardening(); + if (!inf->fn(addr, esr, regs)) { rv = 1; } else {