Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp110884rwp; Wed, 12 Jul 2023 10:23:45 -0700 (PDT) X-Google-Smtp-Source: APBJJlESkKFEV9rNOA2p5wXjEGUjmDakBAmyG1DVYwb3d3RQlxs9irgux9nLZGs8/Ww3irtl0gEt X-Received: by 2002:a05:6a00:2ea3:b0:682:95ab:32f with SMTP id fd35-20020a056a002ea300b0068295ab032fmr18616779pfb.1.1689182624768; Wed, 12 Jul 2023 10:23:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689182624; cv=none; d=google.com; s=arc-20160816; b=EjB6ZqYbsB2N2Lp/vsDV69i+QW1oIoyz+TIcLqg//dfKmgoGrAKqDqu3oLOtsw0Ewf h8XEKzUs4I+Z7P41J0k9NYRB644wVJsuEsgu6grZqhsiOlnOkssBBA7yfkkqa21bfY6R b4/xF1Nv/w3Vnh0x4ip/IPGSsP6hkA2lH88q5nKBaDauRWT8BXHbXaw9FpMiSardId+r HCi4O39MAjBVT7WrnxW9zV03uFCv6bjkgeuRJ9bsBYaOJT1bI63gd5eB6uSRlhvkOO6t mENNvNELDvb4FZFQgc6Gb19rSKNHDYy0FHmK924lnD5tdvNddcMptG6g02CbH1apC2wf vWLA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=pOw98pQ3Xg4VKFxy4pt18FR+Wh1ZzoBxMRhMX9aZkCE=; fh=9ErQMCrVpz6nd+n42KKxHsG2+r/oMfKnhKZOC+GmuKA=; b=p6Bzhq4o9tqkzwcqN+iR4Nw4cGnLOxyMzn9LcZ+qdc+G4Ps28TrElCK7wlHoqathkr LtHfRlKgir1l/IlCr6uCePu1X7XyfM8dqOymjgNFqyxy9RC9PW2mcyXaUQbdnYEJWq6z sN7T8IbHV0Nk9sgMUgDPGCEn+zetMz84pfkd4bf3a8NVWVzL0Kv7vbZ0GSP+XJomH6cw nV+OCdg1cqBM4WF3hoiCsgSzrJE341LS/32U+fl2PV4WdrRLcLbbn5IElQhfLj8WnjWO YYSxIpztBqw8jGL5tWUEod9sgO2lCqJglc7E+XP31q9rFC9ar5cFDPCwl3ngPSey9lLf YwFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b="jo/eNKem"; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bt23-20020a056a00439700b0068255c2b8a8si3547883pfb.151.2023.07.12.10.23.32; Wed, 12 Jul 2023 10:23:44 -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=@amazon.com header.s=amazon201209 header.b="jo/eNKem"; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232776AbjGLRD3 (ORCPT + 99 others); Wed, 12 Jul 2023 13:03:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229649AbjGLRD2 (ORCPT ); Wed, 12 Jul 2023 13:03:28 -0400 Received: from smtp-fw-6002.amazon.com (smtp-fw-6002.amazon.com [52.95.49.90]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4BB661703; Wed, 12 Jul 2023 10:03:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1689181407; x=1720717407; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=pOw98pQ3Xg4VKFxy4pt18FR+Wh1ZzoBxMRhMX9aZkCE=; b=jo/eNKemh3rUC8io42SAHv31/6aT/2tn1DCrNIJYcDQJ0cfj6XtpdL/v q/1JlINJpQZboq53EK+v9kS0pu+dewnxlQqrh9XU/8W6ZA3rM+UVdn392 XjD3flxELT6Zog2YnmMeuRkW+zgUlq0lfnBfy97buQeLaHVk3qyklD4Kf Y=; X-IronPort-AV: E=Sophos;i="6.01,200,1684800000"; d="scan'208";a="344233840" Received: from iad12-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-iad-1a-m6i4x-bbc6e425.us-east-1.amazon.com) ([10.43.8.6]) by smtp-border-fw-6002.iad6.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jul 2023 17:03:24 +0000 Received: from EX19MTAUWB002.ant.amazon.com (iad12-ws-svc-p26-lb9-vlan3.iad.amazon.com [10.40.163.38]) by email-inbound-relay-iad-1a-m6i4x-bbc6e425.us-east-1.amazon.com (Postfix) with ESMTPS id 1C23E80CB2; Wed, 12 Jul 2023 17:03:24 +0000 (UTC) Received: from EX19D002ANA003.ant.amazon.com (10.37.240.141) by EX19MTAUWB002.ant.amazon.com (10.250.64.231) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.30; Wed, 12 Jul 2023 17:03:23 +0000 Received: from b0f1d8753182.ant.amazon.com (10.106.83.21) by EX19D002ANA003.ant.amazon.com (10.37.240.141) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.30; Wed, 12 Jul 2023 17:03:19 +0000 From: Takahiro Itazuri To: CC: , , , , , , Subject: Re: [PATCH 1/1] KVM: pass through CPUID(0x80000006) Date: Wed, 12 Jul 2023 18:02:58 +0100 Message-ID: <20230712170258.75355-1-itazur@amazon.com> X-Mailer: git-send-email 2.38.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.106.83.21] X-ClientProxiedBy: EX19D040UWA004.ant.amazon.com (10.13.139.93) To EX19D002ANA003.ant.amazon.com (10.37.240.141) X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE,T_SPF_PERMERROR autolearn=no 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 On Wed, 12 Jul 2023, Sean Christopherson wrote: > Trimmed the Cc to remove folks that no longer directly work on any of this stuff. I apologize for it and appreciate your reply on this. > > Regard security aspect, I'm a bit concerned that it could help malicious > > guests to know something to allow cache side channel attacks. However, > > CPUID 0x80000006 has already passed through L2 Cache and TLB and L3 > > Cache Information. If passing through CPUID 0x80000006 is really fine, > > I'm guessing it is the case with CPUID 0x80000005 as well. > > It's definitely harmless from a security perspective. Userspace already has > access to this information as CPUID is NOT a priveleged instructions. And the > kernel also publishes this information in sysfs, e.g. /sys/devices/system/cpu/cpuN/cache, > and AFAIK that's not typically restricted. I'm releaved to hear that. > I'm mildly tempted to remove 0x80000006, for similar reasons as commit 45e966fcca03 > ("KVM: x86: Do not return host topology information from KVM_GET_SUPPORTED_CPUID"), > but I suspect that would do more harm than good, e.g. Linux falls back to > 0x80000005 and 0x80000006 when running on AMD without extended topology info. Actually I also saw the commit and I was a bit confused about which leaves to pass through. As you mentioned, CPUID is accessible from userspace and VMM can query it if they want. > I think it makes sense to enumerate 0x80000005. Reporting 0x80000006 but not > 0x80000005 seems to be the *worst* behavior, so as I see it, the decision is > really between adding 0x80000005 and removing 0x80000006. Adding 0x80000005 > appears to be the least risky choice given that KVM has reported 0x80000006 for > over three years. I'm on the same page that either reporting both or none of them is better. I'll create a patch for the least risky one. Best regards, Takahiro Itazuri