From: Ian Jackson Subject: Re: [RFC PATCH 3/6] libxl: implement control feature checking Date: Mon, 16 Nov 2015 17:24:58 +0000 Message-ID: <22090.4458.277707.703173@mariner.uk.xensource.com> References: <1447258719-21891-1-git-send-email-paul.durrant@citrix.com> <1447258719-21891-4-git-send-email-paul.durrant@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1ZyNWZ-00067s-Cd for xen-devel@lists.xenproject.org; Mon, 16 Nov 2015 17:25:03 +0000 In-Reply-To: <1447258719-21891-4-git-send-email-paul.durrant@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: Paul Durrant Cc: xen-devel@lists.xenproject.org, Wei Liu , Ian Campbell , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org Paul Durrant writes ("[RFC PATCH 3/6] libxl: implement control feature checking"): > docs/misc/xenstore-paths documents a set of feature flags that can be used > to determine whether values written to ~/control/shutdown will result in > actions in the guest. > > This patch adds empty guest writable values into xenstore for each > documented feature flag (to allow the guest to update them) and also code > to check these flags to determine whether a specific use of > libxl__domain_pvcontrol() will definitely *not* result in action and fail > the call immediately. I am going to go back and see what you wrote in the spec, but this patch is only correct if the guest is not permitted to infer anything from the existence of these nodes. > diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c > index 279deda..cc82311 100644 > --- a/tools/libxl/libxl_create.c > +++ b/tools/libxl/libxl_create.c > @@ -619,6 +619,28 @@ retry_transaction: > libxl__sprintf(gc, "%s/shutdown", control_path), > rwperm, ARRAY_SIZE(rwperm), > ""); > + libxl__xs_printf_perms(gc, t, > + libxl__sprintf(gc, "%s/feature-poweroff", control_path), > + rwperm, ARRAY_SIZE(rwperm), > + ""); > + libxl__xs_printf_perms(gc, t, > + libxl__sprintf(gc, "%s/feature-reboot", control_path), > + rwperm, ARRAY_SIZE(rwperm), > + ""); This is really very repetitive and also needs more energetic wrapping and also needs to use GCSPRINTF. (Indeed, in several parts of this patch you replace GCSPRINTF calls, but your new code is all libxl__sprintf(gc,)). Thanks, Ian.