From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60586) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eleHa-0000HO-18 for qemu-devel@nongnu.org; Tue, 13 Feb 2018 12:22:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eleHV-00032Z-Pg for qemu-devel@nongnu.org; Tue, 13 Feb 2018 12:22:18 -0500 Received: from mail-it0-x243.google.com ([2607:f8b0:4001:c0b::243]:52710) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eleHV-00032C-JN for qemu-devel@nongnu.org; Tue, 13 Feb 2018 12:22:13 -0500 Received: by mail-it0-x243.google.com with SMTP id o13so11992772ito.2 for ; Tue, 13 Feb 2018 09:22:13 -0800 (PST) References: <20180128221510.13722-1-richard.henderson@linaro.org> <18af5519-95cd-f00e-1915-75183e94eb38@twiddle.net> From: Richard Henderson Message-ID: <0d1c9458-0ab9-cb9e-aee4-9e70f16c9c03@linaro.org> Date: Tue, 13 Feb 2018 09:22:06 -0800 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] linux-user: Use *at functions to implement interp_prefix List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell , Eric Blake Cc: Richard Henderson , QEMU Developers On 02/13/2018 08:50 AM, Peter Maydell wrote: > On 13 February 2018 at 16:43, Peter Maydell wrote: >> OTOH, maybe we should just go ahead without weird games with dup2 and >> see whether any real code gets confused... > > Here's some real-world code that would break with this patch > as it stands, though dup2 games wouldn't be the fix in this case: > https://github.com/xinetd-org/xinetd/blob/master/xinetd/init.c#L79 > > (it iterates through all fds above 2 closing them, and we don't > protect against the guest being able to perform syscalls on > interp_dirfd) Hmm. I suppose we could maintain a fd_set of valid guest fd's, and check every guest operation vs that set. Or special-case interp_dirfd with EBADF. Thoughts before I attempt either? r~