From patchwork Thu Feb 27 17:44:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 11409069 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DFA5414BC for ; Thu, 27 Feb 2020 17:44:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B6013246B0 for ; Thu, 27 Feb 2020 17:44:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582825496; bh=mpYolZHG8Rvhtyy8ykOU3NvHJt669wKPrtsMsgQb4Cs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=U/OZIUj8g9Eo5G97S0iquFks/564SPQ4MyTo0g5JEZ3T30mAS9Oi32hlGKxH9JrL2 LMOPdyO9yWqUygWvuCNqDANDOjp5EN3hBIgLlsjP8PubuJBvrGldleoUp+mD1Uy1QM BNIeJMtUYN6Ecf9rPGbjkZ813YgT5RkWJeTtUtmU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730733AbgB0Roo (ORCPT ); Thu, 27 Feb 2020 12:44:44 -0500 Received: from foss.arm.com ([217.140.110.172]:55676 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730705AbgB0Ron (ORCPT ); Thu, 27 Feb 2020 12:44:43 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E5A42106F; Thu, 27 Feb 2020 09:44:42 -0800 (PST) Received: from localhost (unknown [10.37.6.21]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5BC5A3F73B; Thu, 27 Feb 2020 09:44:42 -0800 (PST) From: Mark Brown To: Catalin Marinas , Will Deacon Cc: Alexander Viro , Paul Elliott , Peter Zijlstra , Yu-cheng Yu , Amit Kachhap , Vincenzo Frascino , Marc Zyngier , Eugene Syromiatnikov , Szabolcs Nagy , "H . J . Lu " , Andrew Jones , Kees Cook , Arnd Bergmann , Jann Horn , Richard Henderson , =?utf-8?q?Kristina_Mart?= =?utf-8?q?=C5=A1enko?= , Thomas Gleixner , Florian Weimer , Sudakshina Das , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-fsdevel@vger.kernel.org, Dave Martin , Mark Brown Subject: [PATCH v8 09/11] arm64: BTI: Reset BTYPE when skipping emulated instructions Date: Thu, 27 Feb 2020 17:44:15 +0000 Message-Id: <20200227174417.23722-10-broonie@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200227174417.23722-1-broonie@kernel.org> References: <20200227174417.23722-1-broonie@kernel.org> MIME-Version: 1.0 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org From: Dave Martin Since normal execution of any non-branch instruction resets the PSTATE BTYPE field to 0, so do the same thing when emulating a trapped instruction. Branches don't trap directly, so we should never need to assign a non-zero value to BTYPE here. Signed-off-by: Dave Martin Signed-off-by: Mark Brown --- arch/arm64/kernel/traps.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c index 3c07a7074145..52ed261e7739 100644 --- a/arch/arm64/kernel/traps.c +++ b/arch/arm64/kernel/traps.c @@ -335,6 +335,8 @@ void arm64_skip_faulting_instruction(struct pt_regs *regs, unsigned long size) if (compat_user_mode(regs)) advance_itstate(regs); + else + regs->pstate &= ~PSR_BTYPE_MASK; } static LIST_HEAD(undef_hook);