From: Wei Liu Subject: Re: [PATCH v2 1/5] libxl: allow /local/domain/0/device-model/$DOMID to be written by $DOMID Date: Sun, 7 Jun 2015 12:39:25 +0100 Message-ID: <20150607113924.GS29102@zion.uk.xensource.com> References: <1433417299-3568-1-git-send-email-stefano.stabellini@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <1433417299-3568-1-git-send-email-stefano.stabellini@eu.citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Stefano Stabellini Cc: wei.liu2@citrix.com, xen-devel@lists.xensource.com, Ian.Jackson@eu.citrix.com, Ian.Campbell@citrix.com List-Id: xen-devel@lists.xenproject.org On Thu, Jun 04, 2015 at 12:28:15PM +0100, Stefano Stabellini wrote: > The device model is going to restrict its xenstore connection to $DOMID > level. Let it access /local/domain/0/device-model/$DOMID, as it is > required by QEMU to read/write the physmap. It doesn't contain any > information the guest is not already fully aware of. The "0" in commit message and title need to be changed to LIBXL_TOOLSTACK_DOMID as well. > > Signed-off-by: Stefano Stabellini > > --- > Changes in v2: > - fix permissions to actually do what intended > - use LIBXL_TOOLSTACK_DOMID instead of 0 > --- > tools/libxl/libxl_dm.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c > index 79a9a22..f4f104f 100644 > --- a/tools/libxl/libxl_dm.c > +++ b/tools/libxl/libxl_dm.c > @@ -1461,6 +1461,7 @@ void libxl__spawn_local_dm(libxl__egc *egc, libxl__dm_spawn_state *dmss) > char **pass_stuff; > const char *dm; > int dm_state_fd = -1; > + struct xs_permissions rwperm[2]; > > if (libxl_defbool_val(b_info->device_model_stubdomain)) { > abort(); > @@ -1503,7 +1504,11 @@ void libxl__spawn_local_dm(libxl__egc *egc, libxl__dm_spawn_state *dmss) > } > > path = libxl__device_model_xs_path(gc, LIBXL_TOOLSTACK_DOMID, domid, ""); > - xs_mkdir(ctx->xsh, XBT_NULL, path); > + rwperm[0].id = LIBXL_TOOLSTACK_DOMID; > + rwperm[0].perms = XS_PERM_NONE; > + rwperm[1].id = domid; > + rwperm[1].perms = XS_PERM_WRITE; > + libxl__xs_mkdir(gc, XBT_NULL, path, rwperm, 2); > > if (b_info->type == LIBXL_DOMAIN_TYPE_HVM && > b_info->device_model_version > -- > 1.7.10.4