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

Re: [RFC PATCH 03/22] x86/msr: always allow a pinned Dom0 to read any unknown MSR


  • To: Edwin Torok <edwin.torok@xxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 31 Oct 2023 11:12:48 +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=LZa/JEOQGel2g+jZK1neLxJBnxevcXhAWuaZC84T+Ko=; b=i9bvoYID03eaMUHtOfRVIEps0PlGlKtQCjQieUT3qXV3O3T7XqatJZxKgdZYUNMbaWBK9+nnN+9sgOHxA5aHM4ytS1lRJTLV9uhyEEBVBOYvDx99XNOGxfUhCQPuMbSWuqWBUzR3mzCPomJ2YyHzyIDR8Vw6xwk9H+yrvAl+dak6mXYcbXdP0YvnWtpWnoZU+Q4UwOe0bavLwNurC3X/TLmw9ioROF03tYHY7KsL950kj5aglI247R2DP1DKGjOiPLddCK5XFZpFhObdqiNhEsG05qkn+AQYIy4zn55kZyDLumMhsVOed0BC59ArrXee10FP/SFmuJ+H0w3Cx26Zfw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Wy01ypS1EUrSk5LEpr/nD4s4O0qZGbUjhqBsiOmnRMpp6aB4CwRSrvrK9CdWwBTSI6vYZ2Pl4CpnXeidayyJUAy54xK8vUcAu10vNAm2dmvCLje93LSquyaRYRCTQwsAHyqh6+iY7/9BBQvKepcYjtKu/cObnpOWFwcUmStLI6Pgvu1NHGIQpGRj/2sj9NKSbtAtBeGnK1LOGczqJ01ccWXWIqoq55NKGPb4RyUOlhtTyrzd3tpZbvoEFiwcI5+ekYhO/qwETQYWO4hokxpTqIzghCwG/C1KlXamBz+qJ4Rh48rk1y84P9vWxKwhJHWT2DW5iavv1gNlfVgAm2xNnQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Edwin Török <edvin.torok@xxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Jun Nakajima <jun.nakajima@xxxxxxxxx>, Kevin Tian <kevin.tian@xxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Tue, 31 Oct 2023 10:13:04 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 31.10.2023 10:31, Edwin Torok wrote:
>> On 30 Oct 2023, at 16:29, Jan Beulich <jbeulich@xxxxxxxx> wrote:
>> On 25.10.2023 21:29, Edwin Török wrote:
>>> This can be useful if you realize you have to inspect the value of an
>>> MSR in production, without having to change into a new Xen first that
>>> handles the MSR.
>>
>> Yet on a non-pinned Dom0 you'd still be lost. Since iirc we generally
>> advise against pinning,
> 
> You can temporarily pin while debugging the issue (e.g. pin just 1 CPU from 
> Dom0, and "walk" all your physical CPUs with it if you have to,
> so that you query them all), e.g. with 'xl vcpu-pin'.
> Although that is more invasive than reading a value.
>  
> Or alternatively have another (privileged) interface to read the MSR for a 
> given core without exposing it to any guests, that way you don't affect the 
> running system at all
> (which would be preferable in a production environment), i.e. a Xen 
> equivalent of 'rdmsr'.

The interface we have (XENPF_resource_op) is, despite being privileged,
deliberately (so far at least) not permitting access to arbitrary MSRs.

In our old XenoLinux forward port we had an extension to the msr.ko
module to allow pCPU-based MSR accesses (and I had a private extension
to the rdmsr/wrmsr user space tools making use of that), but even that
would have been subject to restrictions enforced by Xen as to which
MSRs are accessible.

>> I wonder of how much use such a change would be,
>> when it effectively undoes what we deliberately did a while ago.
>>
>>> --- a/xen/arch/x86/hvm/svm/svm.c
>>> +++ b/xen/arch/x86/hvm/svm/svm.c
>>> @@ -1933,6 +1933,9 @@ static int cf_check svm_msr_read_intercept(
>>>         break;
>>>
>>>     default:
>>> +        if ( is_hwdom_pinned_vcpu(v) && !rdmsr_safe(msr, *msr_content) )
>>> +            break;
>>> +
>>>         if ( d->arch.msr_relaxed && !rdmsr_safe(msr, tmp) )
>>>         {
>>>             *msr_content = 0;
>>
>> If we went as far as undoing some of what was done, I'd then wonder
>> whether instead we should mandate relaxed mode to be enabled on such a
>> Dom0. Then, instead of returning fake 0 here, the actual value could
>> be returned in the specific case of (pinned?) Dom0.
> 
> 
> Can relaxed mode be enabled at runtime?

Not right now, no. But a hypfs control could certainly be added, with
suitable justification.

> I'd be happy with either solution, but it should be something that can be 
> enabled at runtime
> (if you have to reboot Xen then you may lose the bug repro that you want to 
> gather more information on).
> Although changing such a setting in a production environment may still be 
> risky, because the guest will then become very confused that it has 
> previously read some 0s, now there are some real values, and later when you 
> flip the switch off it gets 0s again.

Indeed. If you flipped such a control for any domain at runtime, you'd
better first check that this wouldn't cause any such issues.

Jan



 


Rackspace

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