Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp11317ybf; Wed, 26 Feb 2020 07:58:32 -0800 (PST) X-Google-Smtp-Source: APXvYqxShocZ4N+kASVL3J8tEAgHONUFCEjQws36yMHxGg+jGFoN6iC5EQs/yjr8umn+eEV/qlJK X-Received: by 2002:a05:6830:1e64:: with SMTP id m4mr3797962otr.244.1582732712001; Wed, 26 Feb 2020 07:58:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582732711; cv=none; d=google.com; s=arc-20160816; b=swTAvj6FsdgjBU/bxv/e3Z3lS3szo3IwkOc7F4N8d73Z0rrtJsvt6LTXKyHLCDg9U0 Wvk1KlYHl8Nlm/xyhO02FJ1zuWw3wx4MwyXzzy/tStXPlOuNAKnvS6xZAUbhKCTH+Zr6 kS4Axw3gaoAFfaD14LqVngVRjbQfZ7iXRcsWNpojUAZO0BsBFNYx7heYq6/d55p1gSWZ vxFgcsyESRGSuMUwvDQHi6m9O28VZ2SCf9rYCXhQ55/FWNOukQcA9fF1EvRx95MBUdTb RyhEWTJyzwijzfHHbjRpsRtuq+smwK+WDnODmfiBUM5OJ+xptjNydI+nAaDV9ajMx71+ xd+Q== 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=eRomaYLUnlvwvlBFdzWoOXxjOiCf2DzoTmXb5HPp4AQ=; b=wDxWyi+wsLLdtLAJtxr1zXsQjhRGImuengS6kDWnlq9CtYIhUtKZQGbmAO7AWIUye5 Cy3xBM7uyaSX29N2vW4aupVKYA8dRjRt0Bnb/jUJXcm2ESEcFHrszJaQvUXzSiAmGjoA F9vIMNi/hl6iv5mWr4DzGXlqCNOI1yxD9vQKV4ZsHhTn+exI68R1zAOeGz1mjQ6i3IlH fDlkMspmrd3/5e0kmADOQz+0PbHug+TK0wCaBIoPifEjjk+CsmxoSM69KvzffAXPdbkj soLyI7Z7sgLzuhStsh91Lq0BZ3X+NUAWCwPSKDU2nA0PdX2MAaktgMoYfOlVGDdU6vNp bP0g== 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 i7si1360184oib.63.2020.02.26.07.58.19; Wed, 26 Feb 2020 07:58:31 -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 S1728931AbgBZP55 (ORCPT + 99 others); Wed, 26 Feb 2020 10:57:57 -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=20Mart=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 Content-Transfer-Encoding: 8bit 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(+) 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); -- 2.20.1