From patchwork Wed Feb 26 15:57:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 11406653 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 6C097159A for ; Wed, 26 Feb 2020 15:57:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 41ADB2468E for ; Wed, 26 Feb 2020 15:57:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582732677; bh=mpYolZHG8Rvhtyy8ykOU3NvHJt669wKPrtsMsgQb4Cs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=lQMb2bg4DTeKnWDOP9EopezZ7H1u0b2gQw+SUZdBdwUUAOyo8G3wN3QOZ/bAuJfo/ 1r/RTKbMsWq3T7WwhHwCMFyXYRDvs1Kue6fx+qd0yrbcmGU3efXjwpDfwpPdXUyunx k/QRs5TjzoAGpHU9cNqh79VysW93GdQjEZs3wgkA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728929AbgBZP54 (ORCPT ); Wed, 26 Feb 2020 10:57:56 -0500 Received: from foss.arm.com ([217.140.110.172]:38166 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728652AbgBZP5o (ORCPT ); Wed, 26 Feb 2020 10:57:44 -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 B70354B2; Wed, 26 Feb 2020 07:57:43 -0800 (PST) Received: from localhost (unknown [10.37.6.21]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 011813F819; Wed, 26 Feb 2020 07:57:43 -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 v7 09/11] arm64: BTI: Reset BTYPE when skipping emulated instructions Date: Wed, 26 Feb 2020 15:57:12 +0000 Message-Id: <20200226155714.43937-10-broonie@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200226155714.43937-1-broonie@kernel.org> References: <20200226155714.43937-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);