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 /include | |
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 'include')
-rw-r--r-- | include/linux/binfmts.h | 1 | ||||
-rw-r--r-- | include/linux/sched.h | 2 |
2 files changed, 2 insertions, 1 deletions
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h index cd4349bdc34e..89c6249fc561 100644 --- a/include/linux/binfmts.h +++ b/include/linux/binfmts.h | |||
@@ -109,6 +109,7 @@ extern int prepare_binprm(struct linux_binprm *); | |||
109 | extern int __must_check remove_arg_zero(struct linux_binprm *); | 109 | extern int __must_check remove_arg_zero(struct linux_binprm *); |
110 | extern int search_binary_handler(struct linux_binprm *,struct pt_regs *); | 110 | extern int search_binary_handler(struct linux_binprm *,struct pt_regs *); |
111 | extern int flush_old_exec(struct linux_binprm * bprm); | 111 | extern int flush_old_exec(struct linux_binprm * bprm); |
112 | extern void setup_new_exec(struct linux_binprm * bprm); | ||
112 | 113 | ||
113 | extern int suid_dumpable; | 114 | extern int suid_dumpable; |
114 | #define SUID_DUMP_DISABLE 0 /* No setuid dumping */ | 115 | #define SUID_DUMP_DISABLE 0 /* No setuid dumping */ |
diff --git a/include/linux/sched.h b/include/linux/sched.h index 6f7bba93929b..abdfacc58653 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -1369,7 +1369,7 @@ struct task_struct { | |||
1369 | char comm[TASK_COMM_LEN]; /* executable name excluding path | 1369 | char comm[TASK_COMM_LEN]; /* executable name excluding path |
1370 | - access with [gs]et_task_comm (which lock | 1370 | - access with [gs]et_task_comm (which lock |
1371 | it with task_lock()) | 1371 | it with task_lock()) |
1372 | - initialized normally by flush_old_exec */ | 1372 | - initialized normally by setup_new_exec */ |
1373 | /* file system info */ | 1373 | /* file system info */ |
1374 | int link_count, total_link_count; | 1374 | int link_count, total_link_count; |
1375 | #ifdef CONFIG_SYSVIPC | 1375 | #ifdef CONFIG_SYSVIPC |