From patchwork Wed Dec 11 15:42:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 181260 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp701001ile; Wed, 11 Dec 2019 07:43:24 -0800 (PST) X-Google-Smtp-Source: APXvYqxkhUwrOSzHLk2uyoQYnbnD+nGGFI5pNOSgXYQBsPBlc+k8SiZyQdK15L6C26DeP0dtPe8f X-Received: by 2002:a05:6830:22ee:: with SMTP id t14mr2659729otc.236.1576079004649; Wed, 11 Dec 2019 07:43:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576079004; cv=none; d=google.com; s=arc-20160816; b=l293pSMDyzeMUTO+ce/SMxJi7pV4waa0wRmJpSf/AdxtzLcCy5ZrPNzaV2FTKCknZ+ M2tF2yEZkDBr31ppYNixC0noKD3dH5OMn3fSLadPsCoRSZuG6Zbu2VqWYfkuyCE2kBuY nAsjAN8cVCeIBLqqmYwcVNExw7D6CxoqWqG1jJGYXb5BXVkk7wstMX5ywJujPUQRWCN4 tB2kIK/bptWssqxgjwSsQ4ztFAswM9paaR0xiJvts3/Tl95gXesE+oMMZW9bQPa7Z4SB JUAgPiABc5zhsorhzxmb3RqblDhQqzCOF0MueMnKtU09evmIaj1Hx0svA//Z3zlFVe+k tGmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=e9YqLX5MhzVOhNDAP+AZg2FrvXUvfjQM7El1wCaw0nE=; b=xI2hkB4JR380dxXppE9jw2YXgYERXPVgWx+gi0sYPvpQDFnjyMX/8Hyoh78FFI2512 RxcvIIpOYc6jE1ymCLHYIVe1xmYX0y81Bkso+wOmzzfsfbR464lA1PQRaWZHJH7Qjk8Q ME9+qaXIqF7RFhteNgwK1242RxDladxbpYWuh8K5ZWd29bgrwWXklaahzFJQ2XknNXc4 fM8JcQobUd7y5j3TlwGziIpIkAe2ePpXVd9oMnaXv8vEQae4yQBZRYotdHKTqZJ0cwh0 M2T34lQsB/uPOeKzz5VsukzN7gyKKpBntOY5b57uFD0euiPuJ5DL6joSJWfQUEbFMALn jKiw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c131si1166055oig.170.2019.12.11.07.43.23; Wed, 11 Dec 2019 07:43:24 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387851AbfLKPnT (ORCPT + 27 others); Wed, 11 Dec 2019 10:43:19 -0500 Received: from foss.arm.com ([217.140.110.172]:35612 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388372AbfLKPnO (ORCPT ); Wed, 11 Dec 2019 10:43:14 -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 9F2D431B; Wed, 11 Dec 2019 07:43:13 -0800 (PST) Received: from localhost (unknown [10.37.6.21]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 1EE213F52E; Wed, 11 Dec 2019 07:43:13 -0800 (PST) From: Mark Brown To: Catalin Marinas , Will Deacon Cc: 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=C5=A1enko?= , Thomas Gleixner , Florian Weimer , Sudakshina Das , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, Dave Martin , Mark Brown Subject: [PATCH v4 10/12] arm64: BTI: Reset BTYPE when skipping emulated instructions Date: Wed, 11 Dec 2019 15:42:04 +0000 Message-Id: <20191211154206.46260-11-broonie@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191211154206.46260-1-broonie@kernel.org> References: <20191211154206.46260-1-broonie@kernel.org> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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(+) -- 2.20.1 diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c index bf79d8024fbe..9fc05ae500e6 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 (regs->pstate & PSR_MODE32_BIT) advance_itstate(regs); + else + regs->pstate &= ~PSR_BTYPE_MASK; } static LIST_HEAD(undef_hook);