From patchwork Thu Aug 11 17:02:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver Upton X-Patchwork-Id: 12941652 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B1E31C19F2A for ; Thu, 11 Aug 2022 17:04:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=LfFUCBbJuDNq6xh7NCfQuRMn2r3rA8kxzjzQ6O1306o=; b=pOxXMJLOqPGqpE 8f+6fhBLG8XlnF/Fk31Xdx9L7WMnTIAUQq0yImKmG6hOJqDm9rCP0Is/FhmdTxM085QCa3+DyoNaN Z+FUvtLHbvZ9V7HEV9wjpq0G7jbkuzSvpBZdcnN9pnx7FE9zAxmbuhuyn/MzIhl8C0ov6MwOCKWeF vnyxNZpcXdiFsB5DUZk0HChi9P3n1pHJJHp4SeDHGNafvIIqMn1tZ4wCx3o4ueDtsPdaujg3MzNQ8 Kc7Fr4hjNzWQQ4njuYUAIJtgqZWBEZtk2bt/9Fs7AOAvttAroz7IxUll0kioJ40B2rVDkATh2A9Q8 M8uTGjOKqqCQAIDt5+lg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oMBaH-00FXXR-It; Thu, 11 Aug 2022 17:03:01 +0000 Received: from out2.migadu.com ([188.165.223.204]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oMBZu-00FX3H-M5 for linux-arm-kernel@lists.infradead.org; Thu, 11 Aug 2022 17:02:43 +0000 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1660237357; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xwqZ0bZy9m3Az2vwdpC3agxh+PMnn/lB/GeOwmrcFP0=; b=gG2utxtom6M9C7erZq+CkAs+Mzw6v6mMY1XB/eb6nEgbN7Wsp4x5vPJtbWIJdVO9oHbPo5 7Ei+YWfUnyPA58m3VxoGRdqkdmNGyWSX5kH0nglqYAKFpUPFzgAzP2SFFVUo4bxLwVOZbM pQCsyRnk/wQlNm3xoOegHm8O21rHF2Y= From: Oliver Upton To: kvmarm@lists.cs.columbia.edu Cc: kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, maz@kernel.org, james.morse@arm.com, alexandru.elisei@arm.com, suzuki.poulose@arm.com, will@kernel.org, Oliver Upton Subject: [PATCH 2/2] KVM: arm64: Reject 32bit user PSTATE on asymmetric systems Date: Thu, 11 Aug 2022 17:02:21 +0000 Message-Id: <20220811170221.3771048-3-oliver.upton@linux.dev> In-Reply-To: <20220811170221.3771048-1-oliver.upton@linux.dev> References: <20220811170221.3771048-1-oliver.upton@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220811_100240_464870_0420E2FF X-CRM114-Status: GOOD ( 10.75 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 --- 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: