xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: "Marek Marczykowski-Górecki" <marmarek@invisiblethingslab.com>
To: xen-devel@lists.xenproject.org
Cc: "Anthony PERARD" <anthony.perard@citrix.com>,
	"Ian Jackson" <ian.jackson@eu.citrix.com>,
	"Marek Marczykowski-Górecki" <marmarek@invisiblethingslab.com>,
	"Wei Liu" <wl@xen.org>
Subject: [Xen-devel] [PATCH] libxl: create backend/ xenstore dir for driver domains
Date: Sun,  5 Jan 2020 09:41:48 +0100	[thread overview]
Message-ID: <20200105084148.18887-1-marmarek@invisiblethingslab.com> (raw)

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 <marmarek@invisiblethingslab.com>
---
 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);
-- 
2.21.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

             reply	other threads:[~2020-01-05  8:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-05  8:41 Marek Marczykowski-Górecki [this message]
2020-01-06 14:20 ` [Xen-devel] [PATCH] libxl: create backend/ xenstore dir for driver domains Ian Jackson
2020-01-06 14:38   ` Marek Marczykowski-Górecki
2020-01-06 15:40     ` Ian Jackson
2020-01-06 16:03       ` Marek Marczykowski-Górecki
2020-03-15 22:20         ` Marek Marczykowski-Górecki
2020-03-23 15:35         ` Roger Pau Monné
2020-03-24  2:45           ` [Xen-devel] " Marek Marczykowski-Górecki
2020-03-25 10:36             ` Roger Pau Monné

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200105084148.18887-1-marmarek@invisiblethingslab.com \
    --to=marmarek@invisiblethingslab.com \
    --cc=anthony.perard@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).