From: Hector Marco-Gisbert <hecmargi@upv.es>
To: linux-kernel@vger.kernel.org
Cc: Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
x86@kernel.org, Brian Gerst <brgerst@gmail.com>,
Andy Lutomirski <luto@kernel.org>, Borislav Petkov <bp@suse.de>,
Huaitong Han <huaitong.han@intel.com>,
kees Cook <keescook@chromium.org>,
Ismael Ripoll Ripoll <iripoll@upv.es>,
Hector Marco-Gisbert <hecmargi@upv.es>
Subject: [PATCH] x86_64: Disabling read-implies-exec when the stack is executable
Date: Wed, 11 May 2016 12:45:02 +0200 [thread overview]
Message-ID: <1462963502-11636-1-git-send-email-hecmargi@upv.es> (raw)
The READ_IMPLIES_EXEC personality was removed in 2005 for 64-bit processes,
(commit a3cc2546a54361b86b73557df5b85c4fc3fc27c3 form history.git).
But it's still possible to have all readable areas with EXEC permissions by
setting the stack as executable in 64-bit ELF executables (also in 32-bit).
This is because the macro elf_read_implies_exec() does not distinguish
between 32 and 64-bit executables: when the stack is executable then the
read-implies-exec personality is set (enabled) to the process.
We think that this is not a desirable behaviour, maybe read-implies-exec
could be used via personality but not by setting the stack as executable in
the ELF.
For x86_64 processes, is there any reason to disable read-implies-exec
personality and at the same time enable it when the stack is executable ?
With this patch it's no longer possible to enable the read-implies-exec on
the process by setting the stack as executable in the PT_GNU_STACK on
x86_64 executables.
Regarding 32-bits processes, is there any reason to enable
read-implies-exec by setting the stack as executable instead of using the
personality on X86_32 or when emulating IA32 on X86_64 ?
If not, I could re-send the patch which removes this possibility.
Signed-off-by: Hector Marco-Gisbert <hecmargi@upv.es>
Acked-by: Ismael Ripoll Ripoll <iripoll@upv.es>
---
arch/x86/include/asm/elf.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/include/asm/elf.h b/arch/x86/include/asm/elf.h
index 15340e3..87fd15e 100644
--- a/arch/x86/include/asm/elf.h
+++ b/arch/x86/include/asm/elf.h
@@ -271,8 +271,8 @@ extern int force_personality32;
* An executable for which elf_read_implies_exec() returns TRUE will
* have the READ_IMPLIES_EXEC personality flag set automatically.
*/
-#define elf_read_implies_exec(ex, executable_stack) \
- (executable_stack != EXSTACK_DISABLE_X)
+#define elf_read_implies_exec(ex, executable_stack) \
+ (mmap_is_ia32() ? (executable_stack != EXSTACK_DISABLE_X) : 0)
struct task_struct;
--
1.9.1
next reply other threads:[~2016-05-11 10:46 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-11 10:45 Hector Marco-Gisbert [this message]
2016-05-11 20:49 ` Kees Cook
2016-05-11 22:40 ` Andi Kleen
2016-05-12 2:11 ` Kees Cook
2016-05-16 10:58 ` Ingo Molnar
2019-04-18 7:45 ` Kees Cook
2019-04-18 8:17 ` Thomas Gleixner
2019-04-18 14:11 ` Kees Cook
2019-04-18 14:14 ` Andy Lutomirski
2019-04-18 14:29 ` Kees Cook
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=1462963502-11636-1-git-send-email-hecmargi@upv.es \
--to=hecmargi@upv.es \
--cc=bp@suse.de \
--cc=brgerst@gmail.com \
--cc=hpa@zytor.com \
--cc=huaitong.han@intel.com \
--cc=iripoll@upv.es \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.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
all inboxes | Powered by JetHome®