Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3405999rwa; Tue, 23 Aug 2022 04:21:42 -0700 (PDT) X-Google-Smtp-Source: AA6agR5MdnhJl2PeMogd7aOwSvGebvRwPxx1RsEuHEpA4K9Mdu/Mgrt2PAIq74hhREmkQ/7qPQ6F X-Received: by 2002:a17:90a:fe1:b0:1fb:28b9:3f13 with SMTP id 88-20020a17090a0fe100b001fb28b93f13mr2835069pjz.88.1661253702693; Tue, 23 Aug 2022 04:21:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661253702; cv=none; d=google.com; s=arc-20160816; b=tnN6sxSciiIjvHAR6XCj9GY8qj3KnQZz0TawBlrfUAYi2e9C+jr0Te34esGoPR0reW 6fNsh/fwXoc5dt4d5VX2qs0n6sH0mCrGnRFB52J8Z4qPdkbFgkubFU3xK1rayNdde/Q6 jBDvFMOYLkrbkodoWK56A2A5s+2LCvZo33D1iAkcKYFMQ6mjlfFx5fEkt2vXzxQ9cFXu uMQAEv9SX/bxi4DFQZo+GJILDNVfgJHURfERvot4EvAGFzv0PJomDI/4XhfZin4TMiWN 52tW+AFxNxnJjJH3LIkXHGWnd2aC8V1RWno6cT8kVmLppVi2bdRNpKKzXRa0ns2ZEQl9 Px/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=j5hsWfid2YOlBenboTPQzabvjeVVBFyefGycMcHErU8=; b=Eb1yBdFmxv4tWE6TgDXlQU0bbM4EelEYjuxZiti998MePhyocngGc10WNlxk1SwLBl FduzkdcLqiWBsD7xzhOEKfTPnVnDUIU1hWl/N+FuKU79/6z9W2Vn8Op9RT57CbXwHo/0 NxzEzyHCbb2Ni4Ua0KLArBJNDnhMIvqPMJR7dmAiJLv39FDBSlH0yHh/p87DzKSXkawP HyKGWnLoMpFdMnP4JgJs1TmjqRo1USO0jSH7YNvREgzMHHsXMWuhVfRFqKmMqqmuOPW1 ngKxZViHAMPEyB7AAs2XVbnguRYSc7e+RQRQe+9DHBXqloxaoBCZybwIQji0kxxi6s8G Q9+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yPU8LGtc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c5-20020a170903234500b0016ec623eac3si16149327plh.239.2022.08.23.04.21.31; Tue, 23 Aug 2022 04:21:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yPU8LGtc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348493AbiHWJK2 (ORCPT + 99 others); Tue, 23 Aug 2022 05:10:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240382AbiHWJJP (ORCPT ); Tue, 23 Aug 2022 05:09:15 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB87E86890; Tue, 23 Aug 2022 01:30:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 22BBEB81C35; Tue, 23 Aug 2022 08:29:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 688B3C433D6; Tue, 23 Aug 2022 08:29:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243350; bh=XZXeOQ3dfzBQRzr9znYm6A/X4LWQ1Y7x+rJXgcRbj20=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yPU8LGtc6e7pNSZZEroWwKz6U2N2Oye3CSUGhbkwe3iMgrVlJ3+jFV5/LoCHVJibi Fw1uOeWnEJ7kyAKlyo2e3LdByIwcAIBSxHisYum7PXU0hJwawZJlbQbHy7DxOaY5N7 jqCZTtlCzasR5+CLIhd2f88fadBQ30qFC3gjYAdk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Oliver Upton , Marc Zyngier , Sasha Levin Subject: [PATCH 5.19 250/365] KVM: arm64: Reject 32bit user PSTATE on asymmetric systems Date: Tue, 23 Aug 2022 10:02:31 +0200 Message-Id: <20220823080128.650304002@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Oliver Upton [ Upstream commit b10d86fb8e46cc812171728bcd326df2f34e9ed5 ] KVM does not support AArch32 EL0 on asymmetric systems. To that end, prevent userspace from configuring a vCPU in such a state through setting PSTATE. It is already ABI that KVM rejects such a write on a system where AArch32 EL0 is unsupported. Though the kernel's definition of a 32bit system changed in commit 2122a833316f ("arm64: Allow mismatched 32-bit EL0 support"), KVM's did not. Fixes: 2122a833316f ("arm64: Allow mismatched 32-bit EL0 support") Signed-off-by: Oliver Upton Signed-off-by: Marc Zyngier Link: https://lore.kernel.org/r/20220816192554.1455559-3-oliver.upton@linux.dev Signed-off-by: Sasha Levin --- arch/arm64/kvm/guest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/kvm/guest.c b/arch/arm64/kvm/guest.c index 8c607199cad1..f802a3b3f8db 100644 --- a/arch/arm64/kvm/guest.c +++ b/arch/arm64/kvm/guest.c @@ -242,7 +242,7 @@ static int set_core_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg) u64 mode = (*(u64 *)valp) & PSR_AA32_MODE_MASK; switch (mode) { case PSR_AA32_MODE_USR: - if (!system_supports_32bit_el0()) + if (!kvm_supports_32bit_el0()) return -EINVAL; break; case PSR_AA32_MODE_FIQ: -- 2.35.1