From nobody Mon Nov 23 22:39:35 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=msd.im ARC-Seal: i=1; a=rsa-sha256; t=1792065963; cv=none; d=zohomail.com; s=zohoarc; b=UrLKQoqwN4MCbZ8wY+1Yqnavoa9fc2oz6s5gexannD8dHQp26dL4gf+xXB7zYjPAGqjWBOBpctAssrVome1HQmHiAyiUeQIRpWo7qMx/F39fL6Jk7KKFIjmTBVMOWcsf0EZ9MROsHgnDrGI1bnQT+4T25oPtDF0CqxoTjI3se2M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1792065963; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=jNC0VtpRnQYG7NvlAh0nCFZyKaBNVAXkLz/LsZlGfsE=; b=EzrVAgl0Ori/RowGfvAs9GnWVn7tmDY1FcMNGa1cuguctIV+8eZWkl1E/CG7pSkILiS75ggQcMnCs1qgMxAqkRSlV6Wv3NSmqlXmogEhoRiLXo34FJrWDk+TYoYgnlgS45PWxmuRJMfupkYn76kIRSjBmF1fhbYgcfJtdwm1W7M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1792065962948176.26811200211205; Thu, 15 Oct 2026 05:06:02 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1450302.1665800 (Exim 4.92) (envelope-from ) id 1xHKDU-0005UK-MP; Thu, 15 Oct 2026 12:05:48 +0000 Received: by outflank-mailman (output) from mailman id 1450302.1665800; Thu, 15 Oct 2026 12:05:48 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1xHKDU-0005Tu-ID; Thu, 15 Oct 2026 12:05:48 +0000 Received: by outflank-mailman (input) for mailman id 1450302; Thu, 15 Oct 2026 11:54:36 +0000 Received: from mx.expurgate.net ([195.190.135.20]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1xHK2e-0008SW-4O for xen-devel@lists.xenproject.org; Thu, 15 Oct 2026 11:54:36 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1xHK2d-002Icz-DN for xen-devel@lists.xenproject.org; Thu, 15 Oct 2026 13:54:35 +0200 Received: from [10.42.69.7] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6ad0bef6-2eae-0a2a0a5409dd-0a2a45078606-12 for ; Thu, 15 Oct 2026 13:54:34 +0200 Received: from [87.98.178.58] (helo=17.mo561.mail-out.ovh.net) by tlsNG-ef75cf.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6ad0befa-b4ea-0a2a45070019-5762b23aa18d-3 for ; Thu, 15 Oct 2026 13:54:34 +0200 Received: from director3.ghost.mail-out.ovh.net (unknown [10.110.58.129]) by mo561.mail-out.ovh.net (Postfix) with ESMTP id 4j561k2PcVz60Qp for ; Thu, 15 Oct 2026 11:54:34 +0000 (UTC) Received: from ghost-submission-7ccd8bbbb6-5vnxl (unknown [10.111.174.161]) by director3.ghost.mail-out.ovh.net (Postfix) with ESMTPS id ED105C04CB; Thu, 15 Oct 2026 11:54:33 +0000 (UTC) Received: from msd.im ([37.59.142.103]) by ghost-submission-7ccd8bbbb6-5vnxl with ESMTPSA id I7lrKfm+0GqLRAAAi6cUng (envelope-from ); Thu, 15 Oct 2026 11:54:33 +0000 Received: from mail.msd.im (unknown [192.168.1.32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by msd.im (Postfix) with ESMTPSA id BB7FB20088; Thu, 15 Oct 2026 13:54:32 +0200 (CEST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=msd001 header.d=msd.im header.i="@msd.im" header.h="Date:From:Subject:To:Cc" Authentication-Results: garm.ovh; auth=pass (GARM-103G00513f120ed-6eae-421a-bfcc-7fc479540065, 71189ECCCFDEC51F476E72D41DA47BE09842BDA6) smtp.auth=massedil@msd.im X-OVh-ClientIp: 2.12.250.155 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=msd.im; s=msd001; t=1792065272; bh=fvv3/k0ooz9Ete/etMooXYP7y0WAKHQyPHKVMxH8oQY=; h=Date:From:Subject:To:Cc:From; b=JuE1SI/D2G1EZ4mYtLVLeX20O29Yiu5YrGq2Af4/Dp0XtgU4atQi0gjtnUlhGnuUY dauL2HzZct0bb3SyktnpHriAwwv0I87l24/hQJ9dMH7L9Ygj5fruFGFGcN4iRJg1Kj FKysxdm3XqyOBw3PgDxLfn/K2CzUB0y60LlobFdOkuz5sMGA+L9tnQJ7vPlfwIFRxF KU5V1j9iPSLPjYRmYlb8uQm3Y/faLQN2kH3gKojCdVzHFhrdaDRFyo+oaFdN4clLwX iLtlka7MtfHReeZEU5SGdO0pGXphzMJxR2fsHPPFgdd4Q1Rc+gEqkNHPoc9PceFu6l 4EfFr+fXLNKkw== MIME-Version: 1.0 X-Mailer: SnappyMail/2.36.4 Date: Thu, 15 Oct 2026 11:54:32 +0000 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable From: msd-xenproject.org@msd.im Message-ID: TLS-Required: No Subject: [BUG] libxl: `xl shutdown ""` powers off the host To: xen-devel@lists.xenproject.org Cc: anthony.perard@vates.tech, jgross@suse.com x-ovh-tracer-id: 13761311612377987032 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: dmFkZTFRz6qPYde7IaFNSXlgYqpRwqp/tFhmSwns9NJWoIbrEpE3CIu33jzvX+PUmmsVsKMP7eXP+/WtNSUBUliRzTUkdOMv14XoOPfDNTjUuo2p0zibMD7LE2KIrxUF5pkyHU1lO8edlKnLOumNuwWOYAxmXS19F05i4gXIBb775y4PcKzPD1QC8D1lgexH9Tu8pglZBGLgvG2lIB8U9ob58gqd9d+uLdpu2fU8PDn5CSN3eWFzI7VadOFEyIx9np2XqdmMrG0M1/FdykXVX1OdKTFWxBKqN0TNXDA5F2ulc1ZnxotlXy0GoLqyzfl97ASe03bJV2CSkSrF5Jg59M4VxudhmiuyG7rIj2sWSHFg76CoIUNFaPX5nkWBjVBJBcq9o+YKGo908eluuPXi6nTisrvvZdBvQBPoyG6pnltcKH7u25QqzmfoFtp+eINWLg62ToRqfMUqYg8rZS2UEIYznjWyo/rXKMxUUSXckgotj9JpSj0QTtWL3h0EzApv7oArsU9j8q0GmebBLTUZmA91TdLo+93vwrMGBEQ8Sr1MWVxptLEGuciPjxCbzJqsIzMkRw9CkuiBkECRnemym6CRPeV4zaGYBV87N5jXLmzQE45gNnElfecqMrz/9CO/ckN3ph/RRrjPTaZNFO9FgpkX0hpsJ8kx2a8DJdE5Lcyl+O2dlQ X-purgate-ID: tlsNG-ef75cf/1792065274-A7ED6AE4-91379726/0/0 X-purgate-type: clean X-purgate-size: 2685 X-ZohoMail-DKIM: pass (identity @msd.im) X-ZM-MESSAGEID: 1792065967118158500 Hi, An empty domain qualifier seems silently resolved to domain 0,=20 so a command such as : xl shutdown "" does not fail with an error: it shuts down dom0, which powers off the whole host. Impact ------ We ran `xl shutdown ""` on a Debian host running Xen 4.20.=20 Instead of printing an "invalid domain identifier" error, xl asked dom0 to = shut down, and the physical server powered off, taking every guest down with it. The same input is easy to produce by accident, for example from a shell script with an unset variable: xl shutdown "$VM" # VM is empty or unset The diagnostic and patch is proposed assisted by Anthropic Claude.=20 I haven't tested it, it was generated when I was trying to understand if th= e shutdown behavior is normal. I just hope it will help you understanding faster. Cause (Anthropic Claude) ------------------------ In tools/libs/light/libxl_utils.c: int libxl_domain_qualifier_to_domid(libxl_ctx *ctx, const char *name, uint32_t *domid) { int i, rv; for (i=3D0; name[i]; i++) { if (!CTYPE(isdigit, name[i])) { goto nondigit_found; } } *domid =3D strtoul(name, NULL, 10); return 0; ... With name =3D=3D "", the loop body never runs, so the string is treated as "all digits". strtoul("", NULL, 10) returns 0 without any error detection, and the function returns success with *domid =3D=3D 0. find_domain() in tools/xl/xl_utils.c then sees rc =3D=3D 0 and carries on with domid 0. Every xl subcommand that resolves its argument through find_domain() (destroy, reboot, pause, ...) is affected in the same way. Proposed fix (Anthropic Claude) ------------------------------- Reject the empty string up front, using the same error code as libxl_name_to_domid() already uses for an unknown name. --- a/tools/libs/light/libxl_utils.c +++ b/tools/libs/light/libxl_utils.c @@ -92,6 +92,10 @@ int libxl_domain_qualifier_to_domid(libxl_ctx *ctx, cons= t char *name, uint32_t *domid) { int i, rv; + + if (!name[0]) + return ERROR_INVAL; + for (i=3D0; name[i]; i++) { if (!CTYPE(isdigit, name[i])) { goto nondigit_found; With this, `xl shutdown ""` prints: "" is an invalid domain identifier (rc=3D) and exits with EXIT_FAILURE, without touching dom0. (The line numbers in the hunk header are approximate; We have not built or tested the patch.) -- What do you think about it ? Regards, Msd