From patchwork Wed Jan 22 21:21:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 11346405 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 8F45C139A for ; Wed, 22 Jan 2020 21:22:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6A3C424686 for ; Wed, 22 Jan 2020 21:22:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579728146; bh=Pj6xDpixlGCXbNX+j+u5+AVjcRQciY2xAcvBvaCCio8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=gONfbWDjTK0NVOcnH/GK9sPeS8hiS65KS6BrDVMWJRXyyl+rhK6eQyMZpRdoZallH afSXuOKXs8U94gRBJxKswlUJq84QZG8JFEbIJbmEUkVeZl0mT9V4UCUQyw/hoo4icm OZcktIEZsu+QDnUhxduuRXo2hd1EzTLKmYAVvWkI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729399AbgAVVWW (ORCPT ); Wed, 22 Jan 2020 16:22:22 -0500 Received: from foss.arm.com ([217.140.110.172]:32800 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729299AbgAVVWV (ORCPT ); Wed, 22 Jan 2020 16:22:21 -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 F3CD213FD; Wed, 22 Jan 2020 13:22:20 -0800 (PST) Received: from localhost (unknown [10.37.6.21]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 659203F52E; Wed, 22 Jan 2020 13:22:19 -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 v5 10/12] arm64: BTI: Reset BTYPE when skipping emulated instructions Date: Wed, 22 Jan 2020 21:21:42 +0000 Message-Id: <20200122212144.6409-11-broonie@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200122212144.6409-1-broonie@kernel.org> References: <20200122212144.6409-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 Reviewed-by: Catalin Marinas 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 4fa8b92b8624..be71e5ef9ae0 100644 --- a/arch/arm64/kernel/traps.c +++ b/arch/arm64/kernel/traps.c @@ -332,6 +332,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);