From nobody Tue Feb 10 04:13:19 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=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1674035750; cv=none; d=zohomail.com; s=zohoarc; b=mru55F+COVR7ltMDYB0GvTtBMbNGKE+XDATuE/Ry7GXiSzW7exqRjTXLwO8bCmW6EUpd3TTS6LMJ93IAnnbUge3pg0qjjTahhDF25QpKUblDb8vRwGdHxWBLhYexzL6GKZx6VLbeDEbJud34zW8AWSHiL+D/zWxUOyU34n84fls= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674035750; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=JygJ73dFwifI6ssavbJqcYd36Sd+BW/DYAxzWFIM7/E=; b=HGENsKtEUEdLGvTfdCWw5EaE4cxritr+cPNvsyBIesSx4RxAuiQ9lo248ScEEA4qcejSwK8yQ/nBUonRVFESN6Bb/B9M1E+l3DmhPBV8A32X1jmOvqb9veMTxsN26ln5tfbpzJ2k3RF+TK6aAx5PEb4/DjIcCfm97D1N9uEbn0I= 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=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 167403575053275.9817127586216; Wed, 18 Jan 2023 01:55:50 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.480363.744749 (Exim 4.92) (envelope-from ) id 1pI5A4-0006a0-2T; Wed, 18 Jan 2023 09:55:16 +0000 Received: by outflank-mailman (output) from mailman id 480363.744749; Wed, 18 Jan 2023 09:55:15 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pI5A3-0006Z4-K0; Wed, 18 Jan 2023 09:55:15 +0000 Received: by outflank-mailman (input) for mailman id 480363; Wed, 18 Jan 2023 09:55:13 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pI567-0001BV-TY for xen-devel@lists.xenproject.org; Wed, 18 Jan 2023 09:51:11 +0000 Received: from smtp-out1.suse.de (smtp-out1.suse.de [2001:67c:2178:6::1c]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 6e60f847-9715-11ed-b8d1-410ff93cb8f0; Wed, 18 Jan 2023 10:49:42 +0100 (CET) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id D8D8A38943; Wed, 18 Jan 2023 09:51:09 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id AA50B139D2; Wed, 18 Jan 2023 09:51:09 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id CGJnKA3Bx2O1QwAAMHmgww (envelope-from ); Wed, 18 Jan 2023 09:51:09 +0000 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" X-Inumbo-ID: 6e60f847-9715-11ed-b8d1-410ff93cb8f0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1674035469; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JygJ73dFwifI6ssavbJqcYd36Sd+BW/DYAxzWFIM7/E=; b=EWH3SMhILww2gpd7hcJIBv6pnJY5T6DNSm6IluXhNmNvXorOLLMoyhpVgslfea9FYh7kFl tkz8S6AnDa8gbXiqSJb8dvX4WFRx0d3YT8UmGkIxAzB0t5X+mccVv4wPDU86m3OWF1Mpkd amtqAPLq9mM3QUDZoWYlWoB2+LIEgxs= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Wei Liu , Julien Grall , Anthony PERARD , Julien Grall Subject: [PATCH v4 09/17] tools/xenstore: replace literal domid 0 with dom0_domid Date: Wed, 18 Jan 2023 10:50:08 +0100 Message-Id: <20230118095016.13091-10-jgross@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230118095016.13091-1-jgross@suse.com> References: <20230118095016.13091-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1674035751190100001 Content-Type: text/plain; charset="utf-8" There are some places left where dom0 is associated with domid 0. Use dom0_domid instead. Signed-off-by: Juergen Gross Reviewed-by: Julien Grall --- tools/xenstore/xenstored_core.c | 5 +++-- tools/xenstore/xenstored_domain.c | 8 ++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_cor= e.c index 4582ee39e1..9cfde76898 100644 --- a/tools/xenstore/xenstored_core.c +++ b/tools/xenstore/xenstored_core.c @@ -2297,9 +2297,10 @@ static void accept_connection(int sock) return; =20 conn =3D new_connection(&socket_funcs); - if (conn) + if (conn) { conn->fd =3D fd; - else + conn->id =3D dom0_domid; + } else close(fd); } #endif diff --git a/tools/xenstore/xenstored_domain.c b/tools/xenstore/xenstored_d= omain.c index 703ddeec4e..a703c0ef47 100644 --- a/tools/xenstore/xenstored_domain.c +++ b/tools/xenstore/xenstored_domain.c @@ -326,7 +326,7 @@ static int destroy_domain(void *_domain) if (domain->interface) { /* Domain 0 was mapped by dom0_init, so it must be unmapped using munmap() and not the grant unmap call. */ - if (domain->domid =3D=3D 0) + if (domain->domid =3D=3D dom0_domid) unmap_xenbus(domain->interface); else unmap_interface(domain->interface); @@ -410,7 +410,7 @@ void handle_event(void) =20 static bool domid_is_unprivileged(unsigned int domid) { - return domid !=3D 0 && domid !=3D priv_domid; + return domid !=3D dom0_domid && domid !=3D priv_domid; } =20 bool domain_is_unprivileged(struct connection *conn) @@ -798,7 +798,7 @@ static struct domain *onearg_domain(struct connection *= conn, return ERR_PTR(-EINVAL); =20 domid =3D atoi(domid_str); - if (!domid) + if (domid =3D=3D dom0_domid) return ERR_PTR(-EINVAL); =20 return find_connected_domain(domid); @@ -1004,7 +1004,7 @@ static int chk_domain_generation(unsigned int domid, = uint64_t gen) { struct domain *d; =20 - if (!xc_handle && domid =3D=3D 0) + if (!xc_handle && domid =3D=3D dom0_domid) return 1; =20 d =3D find_domain_struct(domid); --=20 2.35.3