MIPS: Don't clobber personality high bits.
The high bits of current->personality carry settings that we don't want to clobber on each exec. Only clobber them if the lower bits that indicate either PER_LINUX or PER_LINUX32 are invalid. The clobbering prevents us from using useful bits like ADDR_NO_RANDOMIZE. Reported-by: Camm Maguire <camm@maguirefamily.org> Signed-off-by: David Daney <ddaney@caviumnetworks.com> Cc: Camm Maguire <camm@maguirefamily.org> Patchwork: https://patchwork.linux-mips.org/patch/1750/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
This commit is contained in:
parent
1d210386f6
commit
1c0d52b9b5
1 changed files with 6 additions and 2 deletions
|
@ -249,6 +249,7 @@ extern struct mips_abi mips_abi_n32;
|
||||||
|
|
||||||
#define SET_PERSONALITY(ex) \
|
#define SET_PERSONALITY(ex) \
|
||||||
do { \
|
do { \
|
||||||
|
if (personality(current->personality) != PER_LINUX) \
|
||||||
set_personality(PER_LINUX); \
|
set_personality(PER_LINUX); \
|
||||||
\
|
\
|
||||||
current->thread.abi = &mips_abi; \
|
current->thread.abi = &mips_abi; \
|
||||||
|
@ -296,6 +297,8 @@ do { \
|
||||||
|
|
||||||
#define SET_PERSONALITY(ex) \
|
#define SET_PERSONALITY(ex) \
|
||||||
do { \
|
do { \
|
||||||
|
unsigned int p; \
|
||||||
|
\
|
||||||
clear_thread_flag(TIF_32BIT_REGS); \
|
clear_thread_flag(TIF_32BIT_REGS); \
|
||||||
clear_thread_flag(TIF_32BIT_ADDR); \
|
clear_thread_flag(TIF_32BIT_ADDR); \
|
||||||
\
|
\
|
||||||
|
@ -304,7 +307,8 @@ do { \
|
||||||
else \
|
else \
|
||||||
current->thread.abi = &mips_abi; \
|
current->thread.abi = &mips_abi; \
|
||||||
\
|
\
|
||||||
if (current->personality != PER_LINUX32) \
|
p = personality(current->personality); \
|
||||||
|
if (p != PER_LINUX32 && p != PER_LINUX) \
|
||||||
set_personality(PER_LINUX); \
|
set_personality(PER_LINUX); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue