From patchwork Sun Jan 5 08:41:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Marczykowski-G=C3=B3recki?= X-Patchwork-Id: 11318069 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 594D31398 for ; Sun, 5 Jan 2020 08:43:21 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2EDE92085B for ; Sun, 5 Jan 2020 08:43:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="Wqa0f9Vc" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2EDE92085B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=invisiblethingslab.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1io1U1-0003eY-Ob; Sun, 05 Jan 2020 08:42:01 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1io1U0-0003eT-Oj for xen-devel@lists.xenproject.org; Sun, 05 Jan 2020 08:42:01 +0000 X-Inumbo-ID: 3cd5a734-2f97-11ea-a9e8-12813bfff9fa Received: from out1-smtp.messagingengine.com (unknown [66.111.4.25]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 3cd5a734-2f97-11ea-a9e8-12813bfff9fa; Sun, 05 Jan 2020 08:41:59 +0000 (UTC) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 6417C213F4; Sun, 5 Jan 2020 03:41:59 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute7.internal (MEProxy); Sun, 05 Jan 2020 03:41:59 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=cFKggE N7I6PoOpeHPDc+9HU2Tt+TdkmmX1jxkCeENl8=; b=Wqa0f9VcIgJ64PchFOTGeB 2ItWE4KLM6IXd1L1OTxTyBTomd3JS+LqT4GhlaqRxX5Ur68VfRKjivoL3Vb4Uy1t Xecb8QUJ3MaRJZojzt2Ub3GHZSrWsm5gTermL3w3Sm6eWvdhwS32mZScuDE8W2m7 SBc9dBFPiT5G7jx5PfAFA/3ll94fqZw2/NKr+pRRmkwu4kT2DJTdylsNWWL3nQ2v jchKyJyCIrqvnCGs9RvbrdPJ/5nNJwA+W8op382AcLxFqrQ5M6Uw1pGEdbhBeaMh /5LC50CSjl3sxPyCDNwPnE+ptGSsmmBkNYzY8ALXdtTD25lmLogxMIy5C78QtJLQ == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrvdegjedgvdeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffogggtohfgsehtkeertdertdejnecuhfhrohhmpeforghrvghk ucforghrtgiihihkohifshhkihdqifpkrhgvtghkihcuoehmrghrmhgrrhgvkhesihhnvh hishhisghlvghthhhinhhgshhlrggsrdgtohhmqeenucfkphepledurdeihedrfeegrdef feenucfrrghrrghmpehmrghilhhfrhhomhepmhgrrhhmrghrvghksehinhhvihhsihgslh gvthhhihhnghhslhgrsgdrtghomhenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: from localhost.localdomain (ip5b412221.dynamic.kabel-deutschland.de [91.65.34.33]) by mail.messagingengine.com (Postfix) with ESMTPA id 4526B8005C; Sun, 5 Jan 2020 03:41:58 -0500 (EST) From: =?utf-8?q?Marek_Marczykowski-G=C3=B3recki?= To: xen-devel@lists.xenproject.org Date: Sun, 5 Jan 2020 09:41:48 +0100 Message-Id: <20200105084148.18887-1-marmarek@invisiblethingslab.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Organization: Invisible Things Lab Subject: [Xen-devel] [PATCH] libxl: create backend/ xenstore dir for driver domains X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Anthony PERARD , Ian Jackson , =?utf-8?q?Marek_Marczykowski-G?= =?utf-8?q?=C3=B3recki?= , Wei Liu Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Cleaning up backend xenstore entries is a responsibility of the backend. When backend lives outside of dom0, the domain needs proper permissions to do it. Normally it is given permission to remove the device dir itself, but not the dir containing it (named after frontend ID). After a whole those empty leftover directories accumulate to the point xenstore returning E2BIG on listing them. Fix this by giving backend domain write access also to backend/ directory itself when c_info->driver_domain option is set. The code removing relevant dir is already there (just lacked permissions to do so). Note this also allows the backend domain to create new entries, pretending to host backend devices it don't have. But since libxl uses /libxl/ xenstore dir for this information (still outside of backend domain control), this shouldn't be an issue. Signed-off-by: Marek Marczykowski-Górecki --- tools/libxl/libxl_create.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c index a6d40b753e..38ca9b85a4 100644 --- a/tools/libxl/libxl_create.c +++ b/tools/libxl/libxl_create.c @@ -763,6 +763,13 @@ retry_transaction: */ libxl__xs_mknod(gc, t, GCSPRINTF("%s/device-model", dom_path), rwperm, ARRAY_SIZE(rwperm)); + + /* + * Create a local "backend" directory for each guest, writable by that + * guest, to allow it properly cleanup removed devices + */ + libxl__xs_mknod(gc, t, GCSPRINTF("%s/backend", dom_path), rwperm, + ARRAY_SIZE(rwperm)); } vm_list = libxl_list_vm(ctx, &nb_vm);