[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v5 02/12] libx86: introduce helper to fetch cpuid leaf


  • To: Roger Pau Monne <roger.pau@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 6 Dec 2021 15:31:18 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=fORdP+BzeerQGMsb/wiYQImQtw7HqY0znJ8TJp8Yr4M=; b=A60TpJxqwgFoB2nO2M8YZKXeHAkaMnwKxKO0GGkvN6DVH9wVbhnoi8aaNND5Ze3fEzZs4PhlkicwYfvwYjqJbG1jiFMGdzvCDKcSZSOM568eZUBj9ui2GI1/S+/wLGUVHUTYTUkxmo55pujwPt+LZjsOHuVA5FlTr6xd2/4nXJm/iVt4QQAE3Chl3yNBzYrby0SOI3edAeua/bSU9oC/AM6SbuAaeOP+1KPEOlzXLQPj35jqMGXmbaoVoYeY7AVgUw1COanXMsfKcU+VN0dVE8Y+EF5Kz6LjPYSPg+C2dGVf3gcvVlb6oK1smBG5Vhym1OHqyyoLyT8DTfedWh86Lw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MiysS4r+ig1Sa5w9nLkVA1NNj3B+DEpwxLKYCNPNrjOxdEexdKqIMA1ATIuBukLOPI5eSjgsgFoQsf5skOax+RYyVS1TQHhRILq0mayecu7At2/SRe7Vxjgh7p2n93r/2vn9vWlQfeTmz7ql1eTsKiAk0ric0+Z2w7F9xwgddiS+FFmhzleUnKi0yx30wKSCXJYLpGyG+Q3/Nn0UzQ8wLriXsZezRl5Y4CCQBMX1b1CTUh87O1SBf87gK5qzdACglFUqMUtdIpgj3cwB9X4WZJyjk/5Va1Q4Cyp91iy1sK0cvZ5mGVAdP1ksjWWpgqW7Fh3Aq1mAtFu6foJ98nLquw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Mon, 06 Dec 2021 14:31:43 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 29.11.2021 16:33, Roger Pau Monne wrote:
> Introduce a helper based on the current Xen guest_cpuid code in order
> to fetch a cpuid leaf from a policy. The newly introduced function in
> cpuid.c should not be directly called and instead the provided
> x86_cpuid_get_leaf macro should be used that will properly deal with
> const and non-const inputs.
> 
> Also add a test to check that the introduced helper doesn't go over
> the bounds of the policy.
> 
> Note the code in x86_cpuid_copy_from_buffer is not switched to use the
> new function because of the boundary checks against the max fields of
> the policy, which might not be properly set at the point where
> x86_cpuid_copy_from_buffer get called, for example when filling an
> empty policy from scratch.
> 
> Suggested-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
> Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>

Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>

> ---
> Regarding safety of the usage of array_access_nospec to obtain a
> pointer to an element of an array, there are already other instances
> of this usage, for example in viridian_time_wrmsr, so I would assume
> this is fine.

I wonder what it is that you think one might be concerned about. Such
pointer retrieval is no different from an actual array access imo.

Jan




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.