[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v2] x86/livepatch: Fix livepatch application when CET is active
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
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |