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

Re: [PATCH v2 1/2] x86/boot: Clear XD_DISABLE from the early boot path


  • To: Alejandro Vallejo <alejandro.vallejo@xxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 22 Jun 2023 09:54:01 +0200
  • 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=GQs6amXBglCol8jpG9+QLdsd21Le4O76ajg1DPwKOwM=; b=KWyFKeFZgIk/s7l4rTbsvQvGxe0ouOBFaWThzxJL+dzRtBkJgFBrf9XhY/nmkIio9qMb1eefvueIxrx2ZFOMqlcDPGPI+/8ta2TrC9qnHXSGgawQgbjK1RVI6f6vItEnuqgNr7oH8HX0jRiU0fivccA6C4MyLc1EMHHmKxHDPHF+2tvRWOfaNtO796YywyuWu8cgFPmMRttT5010m52wblz66obIGMIPjue2uAGzsyrWRmF9vRP9r8uOr84GrzIhXIsM8BZg+JD/spATrc1w+XgzU0wMyO3nXlmKluXyYKQyZZyBRPR3PtjiM/tS9AZW7ZDsXHUxKhypvfOqJvkc3Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IZHqKk+aWjPFR8k35AvoSShCkc7/E21WaswJJs7RumIrqxTNYCXrfa85lrE2Ba3K+wR1cqjABX0ltZikkhewnYkShF8Vlfjx8kRda2DpuXeJuwAl+eBOdTVtE4YJtgWKOxc9pn9STm6ZklLJD09Kt4JQCPkVePRXv7XZRGCoUGHh70YO9b0TVas3ZGyBdqzO2iDs2eVQP10OkKdDsrO8dMJ8pwwrF8fia8i/SCCar2sv0P0lzXlkL1Wh7L4SLum3/9n7mv1lKDaYxB2mq1AbDVVd1vTZ0JvboZYIa15kuwZMRwN/uwMC3k133Zc3P6Re4jruHxqhFpucHbtFl1c0fQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Delivery-date: Thu, 22 Jun 2023 07:54:13 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 21.06.2023 18:43, Alejandro Vallejo wrote:
> Sure, to everything before this
> 
>>> diff --git a/xen/arch/x86/cpu/intel.c b/xen/arch/x86/cpu/intel.c
>>> index 168cd58f36..46b0cd8dbb 100644
>>> --- a/xen/arch/x86/cpu/intel.c
>>> +++ b/xen/arch/x86/cpu/intel.c
>>> @@ -305,23 +305,23 @@ static void cf_check early_init_intel(struct 
>>> cpuinfo_x86 *c)
>>>             c->x86_cache_alignment = 128;
>>>  
>>>     /* Unmask CPUID levels and NX if masked: */
>>> -   rdmsrl(MSR_IA32_MISC_ENABLE, misc_enable);
>>> -
>>> -   disable = misc_enable & (MSR_IA32_MISC_ENABLE_LIMIT_CPUID |
>>> -                            MSR_IA32_MISC_ENABLE_XD_DISABLE);
>>> -   if (disable) {
>>> -           wrmsrl(MSR_IA32_MISC_ENABLE, misc_enable & ~disable);
>>> -           bootsym(trampoline_misc_enable_off) |= disable;
>>> -           bootsym(trampoline_efer) |= EFER_NXE;
>>> -   }
>>> +   if (rdmsr_safe(MSR_IA32_MISC_ENABLE, misc_enable) == 0) {
>>
>> There's no need to change rdmsrl() to rdmsr_safe(),
> I thought we established before some hypervisors might not implement it. In
> that case this function would crash. More gracefully than a triple fault,
> sure, but still not a very friendly thing to do.

Yet then in early boot code you also don't (and can't) recover from getting
#GP(0), in case that might really happen.

Jan



 


Rackspace

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