From mboxrd@z Thu Jan 1 00:00:00 1970 From: Cyrill Gorcunov Subject: Re: [PATCH] kvm tools: Make 'vm sandbox' more user-friendly Date: Thu, 8 Mar 2012 01:50:09 +0400 Message-ID: <20120307215009.GE6215@moon> References: <1331146439-21710-1-git-send-email-penberg@kernel.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm@vger.kernel.org, Asias He , Ingo Molnar , Sasha Levin To: Pekka Enberg Return-path: Received: from mail-bk0-f46.google.com ([209.85.214.46]:63427 "EHLO mail-bk0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750894Ab2CGVuO (ORCPT ); Wed, 7 Mar 2012 16:50:14 -0500 Received: by bkcik5 with SMTP id ik5so5677373bkc.19 for ; Wed, 07 Mar 2012 13:50:13 -0800 (PST) Content-Disposition: inline In-Reply-To: <1331146439-21710-1-git-send-email-penberg@kernel.org> Sender: kvm-owner@vger.kernel.org List-ID: On Wed, Mar 07, 2012 at 08:53:59PM +0200, Pekka Enberg wrote: > This patch changes 'vm sandbox' to automatically prefix a program path with > "/host" in the guest side making this, for example, work as expected: > > $ ./vm sandbox -- ~/trinity/trinity --mode=random --dangerous > > Cc: Asias He > Cc: Cyrill Gorcunov > Cc: Ingo Molnar > Cc: Sasha Levin > Signed-off-by: Pekka Enberg > --- > tools/kvm/builtin-run.c | 29 ++++++++++++++++++++++++++--- > 1 files changed, 26 insertions(+), 3 deletions(-) > > diff --git a/tools/kvm/builtin-run.c b/tools/kvm/builtin-run.c > index 6acc490..ce76b69 100644 > --- a/tools/kvm/builtin-run.c > +++ b/tools/kvm/builtin-run.c > @@ -847,9 +847,26 @@ static void kvm_write_sandbox_cmd_exactly(int fd, const char *arg) > } > } > > +static void resolve_program(const char *src, char *dst, size_t len) > +{ > + struct stat st; > + > + stat(src, &st); Hi Pekka, looks cool! I suspect we might need to add a check if stat call has not been failed, on top of this patch course ;) Cyrill