From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andre Przywara Subject: [PATCH]: xl: catch invalid numeric domain ID Date: Fri, 21 Jan 2011 17:16:02 +0100 Message-ID: <4D39B142.90806@amd.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------030709030208050605050301" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Ian Jackson , Ian Campbell Cc: "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org --------------030709030208050605050301 Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit Hi, if you run any domain specific xl command with an invalid (aka non-existing) numeric domain ID, the command does not abort, but proceeds with some bogus number: # xl destroy 42 libxl: error: libxl.c:692:libxl_domain_destroy xc_domain_pause failed for 42 libxl: error: libxl_dm.c:705:libxl__destroy_device_model Couldn't find device model's pid: No such file or directory libxl: error: libxl.c:696:libxl_domain_destroy libxl__destroy_device_model failed for 42 libxl: error: libxl_device.c:325:libxl__devices_destroy /local/domain/42/device is empty libxl: error: libxl_dom.c:536:userdata_path unable to find domain info for domain 42: Success libxl: error: libxl.c:713:libxl_domain_destroy xc_domain_destroy failed for 42 The attached patch catches a non-existing domain and returns early (as an invalid domain _name_ would do). Please apply to Xen 4.1.0-rc. Signed-off-by: Andre Przywara -- Andre Przywara AMD-Operating System Research Center (OSRC), Dresden, Germany --------------030709030208050605050301 Content-Type: text/plain; name="xl_fix_invalid_numeric_id.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="xl_fix_invalid_numeric_id.patch" Content-Description: xl_fix_invalid_numeric_id.patch diff -r 003acf02d416 tools/libxl/xl_cmdimpl.c --- a/tools/libxl/xl_cmdimpl.c Thu Jan 20 17:04:06 2011 +0000 +++ b/tools/libxl/xl_cmdimpl.c Fri Jan 21 17:11:10 2011 +0100 @@ -170,6 +170,10 @@ exit(2); } common_domname = was_name ? p : libxl_domid_to_name(&ctx, domid); + if (common_domname == NULL) { + fprintf(stderr, "%d is not a valid domain\n", domid); + exit(2); + } } static int acquire_lock(void) --------------030709030208050605050301 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --------------030709030208050605050301--