linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: seth.forshee@gmail.com (Seth Forshee)
To: linux-arm-kernel@lists.infradead.org
Subject: READ_IMPLIES_EXEC set when no GNU_STACK header present
Date: Tue, 3 Aug 2010 14:58:16 -0500	[thread overview]
Message-ID: <20100803195816.GB31111@ubuntu-workstation> (raw)

We recently noticed that all of our applications had the execute
permission set for any mappings with read permission on an ARMv6
platform. This is happening because the ELF images do not have a
GNU_STACK program header, causing executable_stack=EXSTACK_DEFAULT to be
passed to arm_elf_read_implies_exec(), and it immediately returns 1.

Is this intentional or just an oversight? The patch below removes
READ_IMPLIES_EXEC when GNU_STACK is not present; if this is the desired
behavior I can submit it to the patch system.



commit 6e6d10ae2b5967ce9e9ebe9ebcc6df26a6b57854
Author: Seth Forshee <seth.forshee@gmail.com>
Date:   Tue Aug 3 13:50:41 2010 -0500

    [ARM] enable NX support by default
    
    arm_elf_read_implies_exec() currently returns 1 unless non-
    executable stacks are explicitly requested. This results in
    READ_IMPLIES_EXEC being set for elf images without a GNU_STACK
    program header, even though executable stacks aren't actually
    being requested. This function should default to enabling NX when
    the architecture supports it for better security.
    
    Signed-off-by: Seth Forshee <seth.forshee@gmail.com>

diff --git a/arch/arm/kernel/elf.c b/arch/arm/kernel/elf.c
index d4a0da1..a2eaa6d 100644
--- a/arch/arm/kernel/elf.c
+++ b/arch/arm/kernel/elf.c
@@ -74,7 +74,7 @@ EXPORT_SYMBOL(elf_set_personality);
  */
 int arm_elf_read_implies_exec(const struct elf32_hdr *x, int executable_stack)
 {
-	if (executable_stack != EXSTACK_DISABLE_X)
+	if (executable_stack == EXSTACK_ENABLE_X)
 		return 1;
 	if (cpu_architecture() < CPU_ARCH_ARMv6)
 		return 1;

             reply	other threads:[~2010-08-03 19:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-03 19:58 Seth Forshee [this message]
2010-08-03 20:02 ` READ_IMPLIES_EXEC set when no GNU_STACK header present Russell King - ARM Linux
2010-08-03 20:04   ` Seth Forshee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100803195816.GB31111@ubuntu-workstation \
    --to=seth.forshee@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).