mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH RESEND] x86: Reject x32 executables if x32 ABI not supported
@ 2014-09-07 20:05 Ben Hutchings
  2014-10-04  1:40 ` Ben Hutchings
  2014-10-08  9:21 ` [tip:x86/urgent] " tip-bot for Ben Hutchings
  0 siblings, 2 replies; 5+ messages in thread
From: Ben Hutchings @ 2014-09-07 20:05 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, H. Peter Anvin; +Cc: LKML

[-- Attachment #1: Type: text/plain, Size: 1253 bytes --]

It is currently possible to execve() an x32 executable on an x86_64
kernel that has only ia32 compat enabled.  However all its syscalls
will fail, even _exit().  This usually causes it to segfault.

Change the ELF compat architecture check so that x32 executables are
rejected if we don't support the x32 ABI.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 arch/x86/include/asm/elf.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/x86/include/asm/elf.h b/arch/x86/include/asm/elf.h
index 1a055c8..ca3347a 100644
--- a/arch/x86/include/asm/elf.h
+++ b/arch/x86/include/asm/elf.h
@@ -160,8 +160,9 @@ do {						\
 #define elf_check_arch(x)			\
 	((x)->e_machine == EM_X86_64)
 
-#define compat_elf_check_arch(x)		\
-	(elf_check_arch_ia32(x) || (x)->e_machine == EM_X86_64)
+#define compat_elf_check_arch(x)					\
+	(elf_check_arch_ia32(x) ||					\
+	 (IS_ENABLED(CONFIG_X86_X32_ABI) && (x)->e_machine == EM_X86_64))
 
 #if __USER32_DS != __USER_DS
 # error "The following code assumes __USER32_DS == __USER_DS"


-- 
Ben Hutchings
Experience is directly proportional to the value of equipment destroyed.
                                                         - Carolyn Scheppner

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 811 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH RESEND] x86: Reject x32 executables if x32 ABI not supported
  2014-09-07 20:05 [PATCH RESEND] x86: Reject x32 executables if x32 ABI not supported Ben Hutchings
@ 2014-10-04  1:40 ` Ben Hutchings
  2014-10-05 21:30   ` Thomas Gleixner
  2014-10-08  9:21 ` [tip:x86/urgent] " tip-bot for Ben Hutchings
  1 sibling, 1 reply; 5+ messages in thread
From: Ben Hutchings @ 2014-10-04  1:40 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, H. Peter Anvin; +Cc: LKML

[-- Attachment #1: Type: text/plain, Size: 1351 bytes --]

Can one of you please respond to this patch?

Ben.

On Sun, 2014-09-07 at 21:05 +0100, Ben Hutchings wrote:
> It is currently possible to execve() an x32 executable on an x86_64
> kernel that has only ia32 compat enabled.  However all its syscalls
> will fail, even _exit().  This usually causes it to segfault.
> 
> Change the ELF compat architecture check so that x32 executables are
> rejected if we don't support the x32 ABI.
> 
> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
> ---
>  arch/x86/include/asm/elf.h | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/include/asm/elf.h b/arch/x86/include/asm/elf.h
> index 1a055c8..ca3347a 100644
> --- a/arch/x86/include/asm/elf.h
> +++ b/arch/x86/include/asm/elf.h
> @@ -160,8 +160,9 @@ do {						\
>  #define elf_check_arch(x)			\
>  	((x)->e_machine == EM_X86_64)
>  
> -#define compat_elf_check_arch(x)		\
> -	(elf_check_arch_ia32(x) || (x)->e_machine == EM_X86_64)
> +#define compat_elf_check_arch(x)					\
> +	(elf_check_arch_ia32(x) ||					\
> +	 (IS_ENABLED(CONFIG_X86_X32_ABI) && (x)->e_machine == EM_X86_64))
>  
>  #if __USER32_DS != __USER_DS
>  # error "The following code assumes __USER32_DS == __USER_DS"
> 
> 

-- 
Ben Hutchings
One of the nice things about standards is that there are so many of them.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 811 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH RESEND] x86: Reject x32 executables if x32 ABI not supported
  2014-10-04  1:40 ` Ben Hutchings
@ 2014-10-05 21:30   ` Thomas Gleixner
  2014-10-05 21:39     ` Ben Hutchings
  0 siblings, 1 reply; 5+ messages in thread
From: Thomas Gleixner @ 2014-10-05 21:30 UTC (permalink / raw)
  To: Ben Hutchings; +Cc: Ingo Molnar, H. Peter Anvin, LKML

On Sat, 4 Oct 2014, Ben Hutchings wrote:

> Can one of you please respond to this patch?

Oops. Slipped through the cracks. Picked it up. Shouldn't it be tagged
for stable?

Thanks,

	tglx

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH RESEND] x86: Reject x32 executables if x32 ABI not supported
  2014-10-05 21:30   ` Thomas Gleixner
@ 2014-10-05 21:39     ` Ben Hutchings
  0 siblings, 0 replies; 5+ messages in thread
From: Ben Hutchings @ 2014-10-05 21:39 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: Ingo Molnar, H. Peter Anvin, LKML

[-- Attachment #1: Type: text/plain, Size: 527 bytes --]

On Sun, 2014-10-05 at 23:30 +0200, Thomas Gleixner wrote:
> On Sat, 4 Oct 2014, Ben Hutchings wrote:
> 
> > Can one of you please respond to this patch?
> 
> Oops. Slipped through the cracks. Picked it up. Shouldn't it be tagged
> for stable?

Right.  Please add:

Fixes: d1a797f388d6 ("x32: Handle process creation")
Cc: <stable@vger.kernel.org> # v3.4+

Ben.

-- 
Ben Hutchings
Klipstein's 4th Law of Prototyping and Production:
                                    A fail-safe circuit will destroy others.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 811 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [tip:x86/urgent] x86: Reject x32 executables if x32 ABI not supported
  2014-09-07 20:05 [PATCH RESEND] x86: Reject x32 executables if x32 ABI not supported Ben Hutchings
  2014-10-04  1:40 ` Ben Hutchings
@ 2014-10-08  9:21 ` tip-bot for Ben Hutchings
  1 sibling, 0 replies; 5+ messages in thread
From: tip-bot for Ben Hutchings @ 2014-10-08  9:21 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, tglx, ben

Commit-ID:  0e6d3112a4e95d55cf6dca88f298d5f4b8f29bd1
Gitweb:     http://git.kernel.org/tip/0e6d3112a4e95d55cf6dca88f298d5f4b8f29bd1
Author:     Ben Hutchings <ben@decadent.org.uk>
AuthorDate: Sun, 7 Sep 2014 21:05:05 +0100
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Wed, 8 Oct 2014 11:17:42 +0200

x86: Reject x32 executables if x32 ABI not supported

It is currently possible to execve() an x32 executable on an x86_64
kernel that has only ia32 compat enabled.  However all its syscalls
will fail, even _exit().  This usually causes it to segfault.

Change the ELF compat architecture check so that x32 executables are
rejected if we don't support the x32 ABI.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Link: http://lkml.kernel.org/r/1410120305.6822.9.camel@decadent.org.uk
Cc: stable@vger.kernel.org
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 arch/x86/include/asm/elf.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/x86/include/asm/elf.h b/arch/x86/include/asm/elf.h
index 1a055c8..ca3347a 100644
--- a/arch/x86/include/asm/elf.h
+++ b/arch/x86/include/asm/elf.h
@@ -160,8 +160,9 @@ do {						\
 #define elf_check_arch(x)			\
 	((x)->e_machine == EM_X86_64)
 
-#define compat_elf_check_arch(x)		\
-	(elf_check_arch_ia32(x) || (x)->e_machine == EM_X86_64)
+#define compat_elf_check_arch(x)					\
+	(elf_check_arch_ia32(x) ||					\
+	 (IS_ENABLED(CONFIG_X86_X32_ABI) && (x)->e_machine == EM_X86_64))
 
 #if __USER32_DS != __USER_DS
 # error "The following code assumes __USER32_DS == __USER_DS"

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-10-08  9:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-07 20:05 [PATCH RESEND] x86: Reject x32 executables if x32 ABI not supported Ben Hutchings
2014-10-04  1:40 ` Ben Hutchings
2014-10-05 21:30   ` Thomas Gleixner
2014-10-05 21:39     ` Ben Hutchings
2014-10-08  9:21 ` [tip:x86/urgent] " tip-bot for Ben Hutchings

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome