From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: Re: [PATCH] [RFC] run QEMU as non-root Date: Fri, 15 May 2015 12:32:35 +0100 Message-ID: <1431689555.8943.93.camel@citrix.com> References: <1431625956-4323-1-git-send-email-stefano.stabellini@eu.citrix.com> <1431681949.8943.34.camel@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: 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 List-Id: xen-devel@lists.xenproject.org On Fri, 2015-05-15 at 11:46 +0100, Stefano Stabellini wrote: > On Fri, 15 May 2015, Ian Campbell wrote: > > On Thu, 2015-05-14 at 18:52 +0100, Stefano Stabellini wrote: > > > Run QEMU as non-root. Starting from uid 6000, the chosen uid is > > > base+domid. If the uid doesn't exist, try just 6000. This is less > > > secure: ideally we don't want different domains having their QEMUs > > > running with the same uid. Finally if uid 6000 doesn't exist either, > > > fall back to running QEMU as root. > > > > We can't just pick a random number like that, especially not hardcoded. > > > > You should call getpwent_r. > > Are you suggesting to go over the full list of records in passwd? It > doesn't sound like a good idea. Did you mean getpwnam_r? yes, sorry.