Received: from eggs.gnu.org ([2001:4830:134:3::10]:59185) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VHzFI-0003ft-IG for qemu-devel@nongnu.org; Fri, 06 Sep 2013 12:51:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VHzFD-0005gV-4s for qemu-devel@nongnu.org; Fri, 06 Sep 2013 12:50:56 -0400 Received: from moutng.kundenserver.de ([212.227.17.10]:59204) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VHzFC-0005gP-Lc for qemu-devel@nongnu.org; Fri, 06 Sep 2013 12:50:51 -0400 Message-ID: <522A07E7.6020205@Vivier.EU> Date: Fri, 06 Sep 2013 18:50:47 +0200 From: Laurent Vivier MIME-Version: 1.0 References: <1377820005-3835-1-git-send-email-laurent@vivier.eu> <1377820005-3835-6-git-send-email-laurent@vivier.eu> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH 5/6] linux-user: add support of binfmt_misc 'O' flag List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell , Richard Henderson Cc: Riku Voipio , QEMU Developers Le 06/09/2013 18:17, Peter Maydell a écrit : > On 30 August 2013 00:46, Laurent Vivier wrote: >> The binfmt_misc module can calculate the credentials and security >> token according to the binary instead of to the interpreter if the >> 'C' flag is enabled. >> >> To be able to execute non-readable binaries, this flag implies 'O' >> flag. When 'O' flag is enabled, bintfmt_misc opens the file for >> reading and pass the file descriptor to the interpreter. >> >> References: >> linux/Documentation/binfmt_misc.txt ['O' and 'C' description] >> linux/fs/binfmt_misc.c linux/fs/binfmt_elf.c [ AT_EXECFD usage ] >> +static int get_execfd(char **envp) >> +{ >> + typedef struct { >> + long a_type; >> + long a_val; >> + } auxv_t; >> + auxv_t *auxv; >> + >> + while (*envp++ != NULL) { >> + ; >> + } >> + >> + for (auxv = (auxv_t *)envp; auxv->a_type != AT_NULL; auxv++) { >> + if (auxv->a_type == AT_EXECFD) { >> + return auxv->a_val; >> + } >> + } >> + return -1; >> +} > This looks OK in principle, but this is going to clash > with RTH's auxval related patchset > http://patchwork.ozlabs.org/patch/268006/ > > so some coordination might be a good idea. Yes, thank you to point this out. What is the state of this patches series ? Richard, could you add this as patch #7 ? I think replacing "get_execfd(envp)" by "qemu_getauxval(AT_EXECFD)" should be enough. Do you want I manage this ? Regards, Laurent