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

Re: [PATCH 1/2] tools/libs/light: numa placement: don't try to free a NULL list of vcpus


  • To: "anthony.perard@xxxxxxxxxx" <anthony.perard@xxxxxxxxxx>
  • From: Dario Faggioli <dfaggioli@xxxxxxxx>
  • Date: Fri, 14 Jan 2022 23:22:00 +0000
  • Accept-language: en-US
  • 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=MbHLFDJe3O60XFHf53i4bhkGZyv0z48dBhDIysS3vRs=; b=mhCo4zW9Q24SUiQZcfel6731il4H2ILyVn4l6Zs8rijru3oSaXmqHRXujQi3HwIittpWoJc8bucTg2kd+dFqv8tSMm4ZX28bTBFu3RQ8B1YYdfJPwRFYvaVZfdPUbm1ISS9gIZC/6pQIqP2ZrmA39nt+zpWOHRN2zqMUEaAso/4vH75MbciKUFI5MeOQvdnUNE1OCaTrGWKbIQPxKMphTb5iz5QzzydQ/LFtGR0rg9e9IPOdx2gjvbE18URH2WW+PWwnBEN/zXLmcwA/ac2yFm0QXERG2uMtObKq2mIzMFwQtRhPQG4FGQuP/MyIEs6SxObeA8j3cm0VKQk1fyd3KA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=K89lQN53e/XzKh7IdkIoDTMFjBtqaOPHn9W8VbVzV+r65vyZsiAEDSp35kvnBe9t1YoIdIeEiJUIUTgNfRvCDroQvmcOk+F8d2JsK5g+gZPAcH+hC1pvBrdgVTZEO41JbI9euhs38MBr8HZdY2+kuCZ0jJbonG/VYYcnAS9K6yQOrD2exbrsKs0aPI+ckfgiccFUYFohZFYFNmEAaBzNCYFecubV9qRS/sN+1FY107syHl6O7OsrCgQz4gePnWVliQbtK8PImpNVCd5h/k3Up7wf29ub43AwJH+Hb+5DefGCd7dCJkyY26v/1QnfZxJA/Yx9RV+zx7Hz5EEiyBzvGg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Juergen Gross <JGross@xxxxxxxx>, Jim Fehlig <jfehlig@xxxxxxxx>, "wl@xxxxxxx" <wl@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Fri, 14 Jan 2022 23:22:41 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHYCHXrUuOcqEMe8ki4TaQGMIKek6xjKiKA
  • Thread-topic: [PATCH 1/2] tools/libs/light: numa placement: don't try to free a NULL list of vcpus

On Thu, 2022-01-13 at 12:05 +0000, Anthony PERARD wrote:
> On Wed, Jan 12, 2022 at 05:41:36PM +0100, Dario Faggioli wrote:
> 
> > 2) there should be nothing to free anyway
> 
> The issue here is that it doesn't appear to be true. Even if "info"
> is
> NULL, "nr" have an other value than 0, so libxl_vcpuinfo_list_free()
> will try to access random addresses.
> 
My point here was that if vinfo is NULL (because libxl_list_vcpu()
returned NULL), there aren't any list element or any list to free, so
we can avoid calling libxl_vcpuinfo_list_free().

Then, sure, if we call it with a NULL vinfo and a non-zero
nr_dom_vcpus, things explode, but this was being addressed in patch 2.

This first one was really only about not trying to free an empty list.
And not to workaround the fact that it currently can make things
explode, just because it feels pointless.

> > Signed-off-by: Dario Faggioli <dfaggioli@xxxxxxxx>
> > Tested-by: James Fehlig <jfehlig@xxxxxxxx>
> 
> Can I suggest to make libxl_vcpuinfo_list_free() work a bit better in
> case it's "nr" parameter is wrong? It will do nothing if "list" is
> NULL.
>
I thought about that, and we certainly can do it.

However, I think it's unrelated to this patch so, if I do it, I'll do
it in its own one.

Also, if we go that way, I guess we want to change
libxl_cputopology_list_free(), libxl_pcitopology_list_free(),
libxl_numainfo_list_free(), libxl_dominfo_list_free(),
libxl_vminfo_list_free() and libxl_cpupoolinfo_list_free(), don't we?

> Also I think it is better to keep the free in the exit path at the
> end
> of the loop.
> 
Can I ask why as, as I was trying to say above, if we are sent directly
to next by one of the goto, we do know that vinfo is NULL and
libxl_vcpuinfo_list_free() will be basically a NOP, however it is
implemented.

Of course, you're the maintainer of this code, so I'll do like that if
you ask... I'm just curious. :-)

Actually, if you really think that the call to
libxl_vcpuinfo_list_free() should stay where it is, I can just drop
this patch and go on with patch 2 only, which is enough for fixing the
crash.

Thanks and Regards
-- 
Dario Faggioli, Ph.D
http://about.me/dario.faggioli
Virtualization Software Engineer
SUSE Labs, SUSE https://www.suse.com/
-------------------------------------------------------------------
<<This happens because _I_ choose it to happen!>> (Raistlin Majere)

Attachment: signature.asc
Description: This is a digitally signed message part


 


Rackspace

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