diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-01-29 01:14:42 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-01-29 11:22:01 -0500 |
commit | 221af7f87b97431e3ee21ce4b0e77d5411cf1549 (patch) | |
tree | 480126aada06d87c09cb62e7c8fa292572438c18 /arch/x86/ia32 | |
parent | 64a028a6de08545a2c94f302bc7694bf48aee5b5 (diff) |
Split 'flush_old_exec' into two functions
'flush_old_exec()' is the point of no return when doing an execve(), and
it is pretty badly misnamed. It doesn't just flush the old executable
environment, it also starts up the new one.
Which is very inconvenient for things like setting up the new
personality, because we want the new personality to affect the starting
of the new environment, but at the same time we do _not_ want the new
personality to take effect if flushing the old one fails.
As a result, the x86-64 '32-bit' personality is actually done using this
insane "I'm going to change the ABI, but I haven't done it yet" bit
(TIF_ABI_PENDING), with SET_PERSONALITY() not actually setting the
personality, but just the "pending" bit, so that "flush_thread()" can do
the actual personality magic.
This patch in no way changes any of that insanity, but it does split the
'flush_old_exec()' function up into a preparatory part that can fail
(still called flush_old_exec()), and a new part that will actually set
up the new exec environment (setup_new_exec()). All callers are changed
to trivially comply with the new world order.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Cc: stable@kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/x86/ia32')
-rw-r--r-- | arch/x86/ia32/ia32_aout.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/arch/x86/ia32/ia32_aout.c b/arch/x86/ia32/ia32_aout.c index 2a4d073d2cf1..435d2a5323da 100644 --- a/arch/x86/ia32/ia32_aout.c +++ b/arch/x86/ia32/ia32_aout.c | |||
@@ -308,15 +308,17 @@ static int load_aout_binary(struct linux_binprm *bprm, struct pt_regs *regs) | |||
308 | if (retval) | 308 | if (retval) |
309 | return retval; | 309 | return retval; |
310 | 310 | ||
311 | regs->cs = __USER32_CS; | ||
312 | regs->r8 = regs->r9 = regs->r10 = regs->r11 = regs->r12 = | ||
313 | regs->r13 = regs->r14 = regs->r15 = 0; | ||
314 | |||
315 | /* OK, This is the point of no return */ | 311 | /* OK, This is the point of no return */ |
316 | set_personality(PER_LINUX); | 312 | set_personality(PER_LINUX); |
317 | set_thread_flag(TIF_IA32); | 313 | set_thread_flag(TIF_IA32); |
318 | clear_thread_flag(TIF_ABI_PENDING); | 314 | clear_thread_flag(TIF_ABI_PENDING); |
319 | 315 | ||
316 | setup_new_exec(bprm); | ||
317 | |||
318 | regs->cs = __USER32_CS; | ||
319 | regs->r8 = regs->r9 = regs->r10 = regs->r11 = regs->r12 = | ||
320 | regs->r13 = regs->r14 = regs->r15 = 0; | ||
321 | |||
320 | current->mm->end_code = ex.a_text + | 322 | current->mm->end_code = ex.a_text + |
321 | (current->mm->start_code = N_TXTADDR(ex)); | 323 | (current->mm->start_code = N_TXTADDR(ex)); |
322 | current->mm->end_data = ex.a_data + | 324 | current->mm->end_data = ex.a_data + |