From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36933) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bDwlO-0000ak-4E for qemu-devel@nongnu.org; Fri, 17 Jun 2016 12:36:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bDwlM-0003Z8-VW for qemu-devel@nongnu.org; Fri, 17 Jun 2016 12:36:58 -0400 Received: from mail-vk0-x22a.google.com ([2607:f8b0:400c:c05::22a]:36102) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bDwlM-0003Z3-BD for qemu-devel@nongnu.org; Fri, 17 Jun 2016 12:36:56 -0400 Received: by mail-vk0-x22a.google.com with SMTP id u64so122877397vkf.3 for ; Fri, 17 Jun 2016 09:36:56 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <404917c9-62b2-f853-a4a2-b1d9beb66c81@twiddle.net> References: <1466172679-10156-1-git-send-email-peter.maydell@linaro.org> <404917c9-62b2-f853-a4a2-b1d9beb66c81@twiddle.net> From: Peter Maydell Date: Fri, 17 Jun 2016 17:36:36 +0100 Message-ID: Content-Type: text/plain; charset=UTF-8 Subject: Re: [Qemu-devel] [PATCH] oslib-posix: New qemu_alloc_stack() to allocate stack with correct perms List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Richard Henderson Cc: QEMU Developers , Patch Tracking , Aurelien Jarno , Leon Alrae , Michael Tokarev , "Daniel P. Berrange" , Paolo Bonzini On 17 June 2016 at 17:12, Richard Henderson wrote: > What about using dl_iterate_phdr, looking for PT_GNU_STACK? > That interface is present on a few other hosts besides Linux. We could do that. I note that the MIPS kernel is buggy in that it will assume the stack is executable even if the binary has PT_GNU_STACK saying "please don't be executable". And most architectures except x86-64 won't honour PT_GNU_STACK=non-exec unless the parent process also had nonexec stack (because they let the READ_IMPLIES_EXEC personality flag be inherited; see https://insights.sei.cmu.edu/cert/2014/02/feeling-insecure-blame-your-parent.html ). So the PT_GNU_STACK flag doesn't necessarily match up with either the actual executability of the standard stack or with what the kernel actually requires. > But really this is a place that I'd much rather fall back to an ifdef ladder > than assume executable permission is required. The trouble with this is that it means that as and when the MIPS folks fix their kernel and libc and compiler to support non-exec stacks we won't automatically pick this up, and our stacks will remain executable. Also it requires us to audit every architecture to find out which ones require exec-stack. But maybe it is just MIPS? (Maybe we could just say "this is a MIPS kernel bug" ? :-)) thanks -- PMM