Re: personality does not preserve across execve on s390 (31bit) systems

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Aug 27, 2012 at 07:46:58PM -0400, Mike Frysinger wrote:
> simple test case:
> $ cat test.c
[...]
> running on a s390 (31bit) system fails:
> 	$ uname -a
> 	Linux lgentoo1 3.4.10 #1 SMP Mon Aug 27 17:24:12 EDT 2012 s390 2084 IBM GNU/Linux
> 	$ ./a.out
> 	personality: 0
> 	personality: 0x840000
> 	personality: 0
> 
> running on a s390x (64bit) system works fine:
> 	$ uname -a
> 	Linux lgentoo2 3.4.10 #1 SMP Mon Aug 27 17:28:05 EDT 2012 s390x 2084 IBM GNU/Linux
> 	$ ./a.out
> 	personality: 0
> 	personality: 0x840000
> 	personality: 0x840000

Thanks for reporting! The patch below should fix it:

>From 6aa377637e3b0280ace1ae86780630105de405a1 Mon Sep 17 00:00:00 2001
From: Heiko Carstens <heiko.carstens@xxxxxxxxxx>
Date: Tue, 28 Aug 2012 10:02:08 +0200
Subject: [PATCH] s390/32: Don't clobber personality flags on exec

In native 32 bit mode the personality flags were not correctly inherited.
This is the s390 version of 59e4c3a2 "powerpc/32: Don't clobber personality
flags on exec".

Reported-by: Mike Frysinger <vapier@xxxxxxxxxx>
Signed-off-by: Heiko Carstens <heiko.carstens@xxxxxxxxxx>
---
 arch/s390/include/asm/elf.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/s390/include/asm/elf.h b/arch/s390/include/asm/elf.h
index d7a0ba3..db57594 100644
--- a/arch/s390/include/asm/elf.h
+++ b/arch/s390/include/asm/elf.h
@@ -181,7 +181,8 @@ extern char elf_platform[];
 #define ELF_PLATFORM (elf_platform)
 
 #ifndef CONFIG_64BIT
-#define SET_PERSONALITY(ex) set_personality(PER_LINUX)
+#define SET_PERSONALITY(ex) \
+	set_personality(PER_LINUX | (current->personality & (~PER_MASK)))
 #else /* CONFIG_64BIT */
 #define SET_PERSONALITY(ex)					\
 do {								\
-- 
1.7.11.5

--
To unsubscribe from this list: send the line "unsubscribe linux-s390" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Kernel Development]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Info]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Linux Media]     [Device Mapper]

  Powered by Linux