[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v7 7/9] xen/arm: unpopulate memory when domain is static
- To: Penny Zheng <Penny.Zheng@xxxxxxx>
- From: Jan Beulich <jbeulich@xxxxxxxx>
- Date: Mon, 27 Jun 2022 15:09:31 +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=NFH4uodbb91hO2SaVLJxX3+sc8ovgRyMkIoKp+qXrYc=; b=cNLp+Djuwg2HSeVsqi9pp3YgSggdmwfckr/Vlrs9BelTRb6hCGxr8fgrv0EPk9xv0uPzAg+2MaUMwtG19EqkKHRVBV0yZYZNGj216Ma399HwcW2jtVhpFAHmDqCh8H3pWQhne3eXJAuCXtKM+tD1IJGhb7FthJt6MCYWprl/E3Dr/JISQC0F5exxr+ENawswAiaS3qP+YoOrZBTOr/9dq6Rn/MA9m5pXiPPLwieusUD/LYugiIrJCuLdZO8NQOE8xmSS9gGRUHix+58hbpe4exK55MMqL00DpltyGoyqvIJVFjHvJNap2TT7Wkkl+X/zSk2o6U8F0so7eWgvZO3CTA==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Y/eiX3N9aMqNivC5xHCemPFSORhzL5KUZQHdk7e3KrGu0QVeCI6t+u9PC63HlO6XoAiTuQPsioAcYZQdIMDQleme66wtWYkel0X5R91rhOup/w7m1OxMgYl/BSiDO8hcWMSa9vCvVvXyyWVHMSQv5KFWleZi9ZejgPzAmIVZSWK3/ufRDTs3wnzoF1nnp4rnGy4L7MjamHm7bFmGCcD4lBU9OzFt+BhsDFJWNs7CZ1sZC2KsKcnc2sVKywh/zsWVShpBKJr8h2yU1VcrtOaTEJgW8kSsOXHXPXAz1d3Bo0E39jv/IL1G045Qa4Ov2FHQzLu/YOO7UqaRzO6iw8I/HA==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
- Cc: Wei Chen <Wei.Chen@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- Delivery-date: Mon, 27 Jun 2022 13:09:44 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 27.06.2022 12:03, Penny Zheng wrote:
>> From: Jan Beulich <jbeulich@xxxxxxxx>
>> Sent: Wednesday, June 22, 2022 5:24 PM
>>
>> Furthermore careful with the local variable name used here. Consider what
>> would happen with an invocation of
>>
>> put_static_pages(d, page, i);
>>
>> To common approach is to suffix an underscore to the variable name.
>> Such names are not supposed to be used outside of macros definitions, and
>> hence there's then no potential for such a conflict.
>>
>
> Understood!! I will change "unsigned int i" to "unsigned int _i";
Note how I said "suffix", not "prefix".
>> Finally I think you mean (1u << (order)) to be on the safe side against UB if
>> order could ever reach 31. Then again - is "order" as a parameter needed
>> here in the first place? Wasn't it that staticmem operations are limited to
>> order-0 regions?
>
> Yes, right now, the actual usage is limited to order-0, how about I add
> assertion here
> and remove order parameter:
>
> /* Add page on the resv_page_list *after* it has been freed. */
> if ( unlikely(pg->count_info & PGC_static) )
> {
> ASSERT(!order);
> put_static_pages(d, pg);
> }
I don't mind an ASSERT() as long as upper layers indeed guarantee this.
What I'm worried about is that you might assert on user controlled input.
Jan
|