From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Jackson Subject: [PATCH 21/28] libxl: dm user: Reject attempts to set user!=root with qemu trad Date: Tue, 22 Dec 2015 18:44:56 +0000 Message-ID: <1450809903-3393-22-git-send-email-ian.jackson@eu.citrix.com> References: <1450809903-3393-1-git-send-email-ian.jackson@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1450809903-3393-1-git-send-email-ian.jackson@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: xen-devel@lists.xensource.com Cc: Ian Jackson , Wei Liu , Ian Campbell , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org Previously this option would be silently ignored, which is a potential security problem (introduced in 84f2fd1b "run QEMU as non-root" in xen-unstable only). Signed-off-by: Ian Jackson CC: Stefano Stabellini --- v6: New patch. --- tools/libxl/libxl_dm.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c index 886ed9c..8232981 100644 --- a/tools/libxl/libxl_dm.c +++ b/tools/libxl/libxl_dm.c @@ -415,6 +415,14 @@ static int libxl__build_device_model_args_old(libxl__gc *gc, dm_args = flexarray_make(gc, 16, 1); dm_envs = flexarray_make(gc, 16, 1); + if (b_info->device_model_user && /* default is NULL if stubdom */ + strcmp(b_info->device_model_user,"root")) { + LOG(ERROR, + "device_model_user != root (%s) not supported by qemu-xen-traditional", + b_info->device_model_user); + return ERROR_INVAL; + } + flexarray_vappend(dm_args, dm, "-d", GCSPRINTF("%d", domid), NULL); -- 1.7.10.4