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

Re: [PATCH] x86/CPU/AMD: avoid printing reset reasons on Xen domU


  • To: Sean Christopherson <seanjc@xxxxxxxxxx>, Borislav Petkov <bp@xxxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Fri, 19 Dec 2025 16:26:07 +0000
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=vDsF8Xu9xsyj7dZCtHwBGEEK7+pNe90yIC5FmhpDiR4=; b=dLRKxAJIZ8ls1Y+UJsKz05m7dLvYoCDrakhkIi9TC8IZt9+uQAZRFTJGygfiQl2jvcApv1Kx1YTiqKlhLp0rG97HdHP3kH/dUC/sla+Y2Fr8EuQrBtneEuPb7IhbfIzw1HugV712aKhgbX8WppRvmwMUJ2NjLOuSkjkpHktTEPdlh61UZTpS2q+7xxAqhvWs+JH95IgJHMbEJGhivYGSLvDMkli0vGRk9baILIKeKKxdCDYCK1F4Z0rZaJIRHZzjllsB9WnJHTUDBbVHcO+J7WduLO0aUB/sax1paksht4my2VJVc2qOwlJ6tVh0y6tkGHt69U+Iun7O6XBVMRS5vQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=uNjXOg59bgcoVE4G5Fztjhzyn6x+96UEEs6mPQ2ZHgrFW/Qwa/O2LIKXLG1sQimio8jA9yKimwWpIE1L8AB0tAYUYcO4ImJRDV2MXXr9jWPnFu7aGEl2hyXmBIci5KbZVEto11QX/MTJqf2m+dUa0i9Za8boyELhyOBYsShacSTUZSDMe6ofx9d5PGVqd4nW4YhdzdTkRNXSHvoAVs3TWEdDIa7eqIQMyO1Q51yG1yuHX988GgO/udfTU0VoSeYYh2bTmWFpKznMVRfwTwA7R4cq5Kne6gqb4n/ThPjDGFnGhv2jbPss4UXA9084yrF3SIvVpz5uIzAXdcNEPDTq+g==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Ariadne Conill <ariadne@ariadne.space>, linux-kernel@xxxxxxxxxxxxxxx, mario.limonciello@xxxxxxx, darwi@xxxxxxxxxxxxx, sandipan.das@xxxxxxx, kai.huang@xxxxxxxxx, me@xxxxxxxxxxx, yazen.ghannam@xxxxxxx, riel@xxxxxxxxxxx, peterz@xxxxxxxxxxxxx, hpa@xxxxxxxxx, x86@xxxxxxxxxx, tglx@xxxxxxxxxxxxx, mingo@xxxxxxxxxx, dave.hansen@xxxxxxxxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxxx, stable@xxxxxxxxxxxxxxx
  • Delivery-date: Fri, 19 Dec 2025 16:26:30 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 19/12/2025 4:09 pm, Sean Christopherson wrote:
> On Fri, Dec 19, 2025, Borislav Petkov wrote:
>> On December 19, 2025 1:01:31 AM UTC, Ariadne Conill <ariadne@ariadne.space> 
>> wrote:
>>> Xen domU cannot access the given MMIO address for security reasons,
>>> resulting in a failed hypercall in ioremap() due to permissions.
> Why does that matter though?  Ah, because set_pte() assumes success, and so
> presumably the failed hypercall goes unnoticed and trying to access the MMIO
> #PFs due to !PRESENT mapping.
>
>>> Fixes: ab8131028710 ("x86/CPU/AMD: Print the reason for the last reset")
>>> Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
>>> Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx
>>> Cc: stable@xxxxxxxxxxxxxxx
>>> ---
>>> arch/x86/kernel/cpu/amd.c | 6 ++++++
>>> 1 file changed, 6 insertions(+)
>>>
>>> diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
>>> index a6f88ca1a6b4..99308fba4d7d 100644
>>> --- a/arch/x86/kernel/cpu/amd.c
>>> +++ b/arch/x86/kernel/cpu/amd.c
>>> @@ -29,6 +29,8 @@
>>> # include <asm/mmconfig.h>
>>> #endif
>>>
>>> +#include <xen/xen.h>
>>> +
>>> #include "cpu.h"
>>>
>>> u16 invlpgb_count_max __ro_after_init = 1;
>>> @@ -1333,6 +1335,10 @@ static __init int print_s5_reset_status_mmio(void)
>>>     if (!cpu_feature_enabled(X86_FEATURE_ZEN))
>>>             return 0;
>>>
>>> +   /* Xen PV domU cannot access hardware directly, so bail for domU case */
> Heh, Xen on Zen crime.
>
>>> +   if (cpu_feature_enabled(X86_FEATURE_XENPV) && !xen_initial_domain())
>>> +           return 0;
>>> +
>>>     addr = ioremap(FCH_PM_BASE + FCH_PM_S5_RESET_STATUS, sizeof(value));
>>>     if (!addr)
>>>             return 0;
>> Sean, looka here. The other hypervisor wants other checks.
>>
>> Time to whip out the X86_FEATURE_HYPERVISOR check.
> LOL, Ariadne, be honest, how much did Boris pay you?  :-D
>
> Jokes aside, I suppose I'm fine adding a HYPERVISOR check, but at the same 
> time,
> how is this not a Xen bug?  Refusing to create a mapping because the VM 
> doesn't
> have a device defined at a given GPA is pretty hostile behavior for a 
> hypervisor.
>

This is a Xen PV guest.  No SVM/VT-x.

A PV Guest (by it's contract with Xen) cannot create mappings to host
physical addresses it doesn't own.  Xen rejects the attempt, and Linux
is ignoring the failure in this case.  This has been ABI for 25 years.

>From a more practical point of view, because guests can read their own
pagetables, Xen can't swap the requested PTE for safe alternative to
trap the MMIO access, because that violates Linux's model of what's
mapped in this position.

~Andrew



 


Rackspace

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