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

Re: [PATCH v2] x86/livepatch: Fix livepatch application when CET is active


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 18 Apr 2023 07:58:51 +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=F0J6n+628K/rBspYGtEVewmfWl9VC5Wiprn+3uP2ZZA=; b=I8PImZFcnU/Bx4wTvj4+eKQ88DNkSTOQIjMCNR0LHG8Bci2BMmtsbcgk/PxU97quO47h2R7l3x0EKm97KfJzLUHtEwoJW/9W3qgiW3jzJ3q9lUVLt05jIy+O2v2AvBc5022CCuJxOPWybUjy9D+77imIAlZQQs2VSK7O2N1f544n9FquN76CYXs2Uin7UdY5iVw5NVflipCKn09djZ6/nYiWUbYtjLxXf/I/Pjh/uT5eA10MienWVET9qcl068AnZDENInHmoINXalTaEJoAnbXNtvqTWv0l0PvnaI93zfEJO3flljMQlsk55tDzMyYG1RhhZpFKRPLIRQKu6uNscA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DaueH2BMBXTMVlYUPiHvgBqP9qJcNSybLyVvrePY6hQ99nnRqL9IXw7uebCwMT4xNLKpleTkggFplU9VE7plSa8LyO90Uw1y9aYvM5jESEFuy0QaKtd0X2gYB+UBRw/bxoD17tRrwPAazf6h5w+ZWJ+d8rYA4krlVDs2AH2jc9RWyGGoOojPxc7cxT2suPtgPo/ikhE3w4T9b9Nf20MauqgUQmllLzTspRrm1uBwiKJmumYjki4nTSaYtwNTZFl83/0V+qvCiuf5ryQPbmznC84ZQ7gNl9gX3ccFMGe5AbeW658YM+UXkr8lR4o3JxK0GZ7Nrs6uzzagVbpQsXDaYg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>, Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Tue, 18 Apr 2023 05:59:31 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 17.04.2023 21:34, Andrew Cooper wrote:
> On 17/04/2023 3:51 pm, Jan Beulich wrote:
>> On 17.04.2023 16:41, Andrew Cooper wrote:
>>> On 17/04/2023 2:59 pm, Jan Beulich wrote:
>>>> On 17.04.2023 15:52, Andrew Cooper wrote:
>>>>> @@ -5879,6 +5880,73 @@ int destroy_xen_mappings(unsigned long s, unsigned 
>>>>> long e)
>>>>>      return modify_xen_mappings(s, e, _PAGE_NONE);
>>>>>  }
>>>>>  
>>>>> +/*
>>>>> + * Similar to modify_xen_mappings(), but used by the alternatives and
>>>>> + * livepatch in weird contexts.  All synchronization, TLB flushing, etc 
>>>>> is the
>>>>> + * responsibility of the caller, and *MUST* not be introduced here.
>>>>> + *
>>>>> + * Must be limited to XEN_VIRT_{START,END}, i.e. over l2_xenmap[].
>>>>> + * Must be called with present flags, and over present mappings.
>>>>> + * Must be called on leaf page boundaries.
>>>> This last sentence, while wording-wise correct, could do with making more
>>>> explicit that it is the caller's responsibility to know whether large page
>>>> mappings are in use, due to ...
>>> The meaning here is really "this doesn't shatter superpages", and this
>>> was the most concise I could come up with.
>>>
>>> Would ", i.e. won't shatter 2M pages." as a clarification work?
>> Yes, that would definitely help. Nevertheless I was more after something
>> like "..., i.e. for 2M mappings on 2M boundaries." Which, thinking about
>> it, points out that while you have a respective check for the start
>> address, the full 2M page would be changed even if the end address wasn't
>> 2M aligned (but fell in the middle of a 2M page).
> 
> There's no nice way to check for because a range that starts on a 4k
> non-2M boundary can legitimately end on a 2M boundary at 4k granularity.

How about

        if ( l2e_get_flags(l2e) & _PAGE_PSE )
        {
            ASSERT(l1_table_offset(v) == 0);
            ASSERT(e - v >= (1UL << L2_PAGETABLE_SHIFT));

?

> How about ", i.e. s and e must not be in the middle of a superpage." then?

That sounds good, thanks.

Jan



 


Rackspace

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