Message ID | 20220419065544.3616948-6-reijiw@google.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org> 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 09891C43217 for <linux-arm-kernel@archiver.kernel.org>; Tue, 19 Apr 2022 06:59:43 +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:Cc:To:From:Subject:References: Mime-Version:Message-Id:In-Reply-To:Date:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=zaOFNhTAbH/PSXrxsZmyfV3Z28zcRkAiFS+1+3LxvxM=; b=xe0QVV//Mb2ZYtya0QCVFFUfKQ FXWDrT/6jz0GMli2wvUq3VipO5KDsJIrU1n+Xn/6Py9ZsZhU2yHJi3cPAvaoenCStmMWJFZUOXi8y Sjy6YlyHoYXAJyRMixk08XoLA2CHhfK7DV8zaoxzD6/j76TjimrnZAYGT0F1efFtigX5sltr7m6Hy iMUiTDTywgBnHtCokwxlvu9TJ/C//3bHIiATdOLs+jhMFQ6jSo4e1mbRcqkGYFysvyaxtclfw1gtH ghlp9PTcBkC9SrKDhug9fAQVWbDCdCTbHAIQPSPxUKICRjoxDYV9ACuABtj7S28l/4ZfYia2wb+aX OOUo2NMw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nghoq-001o5x-3j; Tue, 19 Apr 2022 06:58:36 +0000 Received: from mail-pj1-x104a.google.com ([2607:f8b0:4864:20::104a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nghnX-001nNI-Az for linux-arm-kernel@lists.infradead.org; Tue, 19 Apr 2022 06:57:16 +0000 Received: by mail-pj1-x104a.google.com with SMTP id pb1-20020a17090b3c0100b001d2b09b6185so1043887pjb.2 for <linux-arm-kernel@lists.infradead.org>; Mon, 18 Apr 2022 23:57:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=DnB6mkT71yKfiG5xjrOUttE90Hmb51/VYCnn9fFtof4=; b=ZbU4DI8LNyuRtCFqPLEdyNdwHwoaTlUuA0oTrVeKfChCv8RdXwbrsDjHZp/0f6FQnP PZLE4A7NgUR6x0oMr5exTueSSuVho7obJ7dNzlyMTCr7HwLw6BKGJra91wUoMx3wlcb6 bSQgSXwurkj3VYnxA575UdfzsJ87lzw9afbZ03AYvGQBQjegBxyQqcW+BA/oZie6o1mF Yh4sHj8EegW8bDGiPBecdj0wvXoudVP1mUn1WVnV9+uzP0TsHZWRMOL2i/nuqQfZnjxy xbyWDd7Or3+beb4xI3uCxytRvzji52R4qg7KmFzoyO/a+cO5Ag0fHz60VLe8FWFkTWw9 Li0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=DnB6mkT71yKfiG5xjrOUttE90Hmb51/VYCnn9fFtof4=; b=hwGiNmnOho6EVkRlsu+0SbGC1bajCMf7roPge/SLVndyf3dIQhaThI9erzUW7YgpZN MgZHVujN2bWe/mpRqf2r6O/pxfDRol5LWAxqYNb4DTAJxYByKtiSBviN4LGcQja+Ne50 z5TaT5Mm/YYCA/KgxeftDpoHUI9wUnQ8hiVgGmWy5zAElIn8BF+iCbVooFVbEdQXspG1 VsmwqHFarkOp7Qa8OXgLWXaW1OyquSM9V6Vc9Y7Vn5+IXuwhW+QWZDn0/fofwUBH34XT JRNK63Zz6OUiqgd3JFE3DSMb8vhnbOynOiEimkyN0R44S551vWrlgNkLHdpoM6lmy0Ld euJw== X-Gm-Message-State: AOAM5313YevrXRWDvZngzrUvuxGGf5DySMZ/Q5DyTSzTkV2d2HuHqNW1 +PvNAxjLGXQCZoLw/NuEv9B1QXT2zSw= X-Google-Smtp-Source: ABdhPJzKDkHVW1R2MC+Nhg/V/wFyysks9SmrrOZPKWBr9DJqaBdQnJOCmh0zLDSQV1Z/jaqGVIPM47cp9DI= X-Received: from reiji-vws-sp.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:3d59]) (user=reijiw job=sendgmr) by 2002:a17:90b:2384:b0:1cb:5223:9dc4 with SMTP id mr4-20020a17090b238400b001cb52239dc4mr276794pjb.1.1650351433778; Mon, 18 Apr 2022 23:57:13 -0700 (PDT) Date: Mon, 18 Apr 2022 23:55:11 -0700 In-Reply-To: <20220419065544.3616948-1-reijiw@google.com> Message-Id: <20220419065544.3616948-6-reijiw@google.com> Mime-Version: 1.0 References: <20220419065544.3616948-1-reijiw@google.com> X-Mailer: git-send-email 2.36.0.rc0.470.gd361397f0d-goog Subject: [PATCH v7 05/38] KVM: arm64: Prohibit modifying values of ID regs for 32bit EL1 guests From: Reiji Watanabe <reijiw@google.com> To: Marc Zyngier <maz@kernel.org>, kvmarm@lists.cs.columbia.edu Cc: kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, James Morse <james.morse@arm.com>, Alexandru Elisei <alexandru.elisei@arm.com>, Suzuki K Poulose <suzuki.poulose@arm.com>, Paolo Bonzini <pbonzini@redhat.com>, Will Deacon <will@kernel.org>, Andrew Jones <drjones@redhat.com>, Fuad Tabba <tabba@google.com>, Peng Liang <liangpeng10@huawei.com>, Peter Shier <pshier@google.com>, Ricardo Koller <ricarkol@google.com>, Oliver Upton <oupton@google.com>, Jing Zhang <jingzhangos@google.com>, Raghavendra Rao Anata <rananta@google.com>, Reiji Watanabe <reijiw@google.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220418_235715_452739_9DC277B0 X-CRM114-Status: GOOD ( 12.91 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: <linux-arm-kernel.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-arm-kernel/> List-Post: <mailto:linux-arm-kernel@lists.infradead.org> List-Help: <mailto:linux-arm-kernel-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" <linux-arm-kernel-bounces@lists.infradead.org> Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org |
Series |
KVM: arm64: Make CPU ID registers writable by userspace
|
expand
|
diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c index b19e14a1206a..bc06570523f4 100644 --- a/arch/arm64/kvm/sys_regs.c +++ b/arch/arm64/kvm/sys_regs.c @@ -1537,6 +1537,10 @@ static int __set_id_reg(struct kvm_vcpu *vcpu, if (raz) return -EINVAL; + /* Don't allow to modify the register's value for the 32bit EL1 guest */ + if (test_bit(KVM_ARCH_FLAG_EL1_32BIT, &vcpu->kvm->arch.flags)) + return -EPERM; + /* * Don't allow to modify the register's value if the register doesn't * have the id_reg_desc.
Prohibit userspace from modifying values of ID registers. (Don't support configurable ID registers for 32bit EL1 guests) NOTE: The following patches will enable trapping disabled features only based on values of AArch64 ID registers for the guest expecting userspace to make AArch32 ID registers consistent with the AArch64 ones (Otherwise, it will be a userspace bug). Supporting 32bit EL1 guests will require that KVM will not enable trapping based on values of AArch64 ID registers (and should enable trapping based on the AArch32 ID registers when possible). Signed-off-by: Reiji Watanabe <reijiw@google.com> --- arch/arm64/kvm/sys_regs.c | 4 ++++ 1 file changed, 4 insertions(+)