diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-12 15:22:13 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-12 15:22:13 -0500 |
| commit | 9977d9b379cb77e0f67bd6f4563618106e58e11d (patch) | |
| tree | 0191accfddf578edb52c69c933d64521e3dce297 /include/linux | |
| parent | cf4af01221579a4e895f43dbfc47598fbfc5a731 (diff) | |
| parent | 541880d9a2c7871f6370071d55aa6662d329c51e (diff) | |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal
Pull big execve/kernel_thread/fork unification series from Al Viro:
"All architectures are converted to new model. Quite a bit of that
stuff is actually shared with architecture trees; in such cases it's
literally shared branch pulled by both, not a cherry-pick.
A lot of ugliness and black magic is gone (-3KLoC total in this one):
- kernel_thread()/kernel_execve()/sys_execve() redesign.
We don't do syscalls from kernel anymore for either kernel_thread()
or kernel_execve():
kernel_thread() is essentially clone(2) with callback run before we
return to userland, the callbacks either never return or do
successful do_execve() before returning.
kernel_execve() is a wrapper for do_execve() - it doesn't need to
do transition to user mode anymore.
As a result kernel_thread() and kernel_execve() are
arch-independent now - they live in kernel/fork.c and fs/exec.c
resp. sys_execve() is also in fs/exec.c and it's completely
architecture-independent.
- daemonize() is gone, along with its parts in fs/*.c
- struct pt_regs * is no longer passed to do_fork/copy_process/
copy_thread/do_execve/search_binary_handler/->load_binary/do_coredump.
- sys_fork()/sys_vfork()/sys_clone() unified; some architectures
still need wrappers (ones with callee-saved registers not saved in
pt_regs on syscall entry), but the main part of those suckers is in
kernel/fork.c now."
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal: (113 commits)
do_coredump(): get rid of pt_regs argument
print_fatal_signal(): get rid of pt_regs argument
ptrace_signal(): get rid of unused arguments
get rid of ptrace_signal_deliver() arguments
new helper: signal_pt_regs()
unify default ptrace_signal_deliver
flagday: kill pt_regs argument of do_fork()
death to idle_regs()
don't pass regs to copy_process()
flagday: don't pass regs to copy_thread()
bfin: switch to generic vfork, get rid of pointless wrappers
xtensa: switch to generic clone()
openrisc: switch to use of generic fork and clone
unicore32: switch to generic clone(2)
score: switch to generic fork/vfork/clone
c6x: sanitize copy_thread(), get rid of clone(2) wrapper, switch to generic clone()
take sys_fork/sys_vfork/sys_clone prototypes to linux/syscalls.h
mn10300: switch to generic fork/vfork/clone
h8300: switch to generic fork/vfork/clone
tile: switch to generic clone()
...
Conflicts:
arch/microblaze/include/asm/Kbuild
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/binfmts.h | 4 | ||||
| -rw-r--r-- | include/linux/compat.h | 4 | ||||
| -rw-r--r-- | include/linux/coredump.h | 4 | ||||
| -rw-r--r-- | include/linux/fdtable.h | 1 | ||||
| -rw-r--r-- | include/linux/fs_struct.h | 1 | ||||
| -rw-r--r-- | include/linux/ptrace.h | 13 | ||||
| -rw-r--r-- | include/linux/sched.h | 7 | ||||
| -rw-r--r-- | include/linux/syscalls.h | 16 |
8 files changed, 34 insertions, 16 deletions
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h index cfcc6bfcaec0..2630c9b41a86 100644 --- a/include/linux/binfmts.h +++ b/include/linux/binfmts.h | |||
| @@ -72,7 +72,7 @@ struct coredump_params { | |||
| 72 | struct linux_binfmt { | 72 | struct linux_binfmt { |
| 73 | struct list_head lh; | 73 | struct list_head lh; |
| 74 | struct module *module; | 74 | struct module *module; |
| 75 | int (*load_binary)(struct linux_binprm *, struct pt_regs * regs); | 75 | int (*load_binary)(struct linux_binprm *); |
| 76 | int (*load_shlib)(struct file *); | 76 | int (*load_shlib)(struct file *); |
| 77 | int (*core_dump)(struct coredump_params *cprm); | 77 | int (*core_dump)(struct coredump_params *cprm); |
| 78 | unsigned long min_coredump; /* minimal dump size */ | 78 | unsigned long min_coredump; /* minimal dump size */ |
| @@ -95,7 +95,7 @@ extern void unregister_binfmt(struct linux_binfmt *); | |||
| 95 | 95 | ||
| 96 | extern int prepare_binprm(struct linux_binprm *); | 96 | extern int prepare_binprm(struct linux_binprm *); |
| 97 | extern int __must_check remove_arg_zero(struct linux_binprm *); | 97 | extern int __must_check remove_arg_zero(struct linux_binprm *); |
| 98 | extern int search_binary_handler(struct linux_binprm *, struct pt_regs *); | 98 | extern int search_binary_handler(struct linux_binprm *); |
| 99 | extern int flush_old_exec(struct linux_binprm * bprm); | 99 | extern int flush_old_exec(struct linux_binprm * bprm); |
| 100 | extern void setup_new_exec(struct linux_binprm * bprm); | 100 | extern void setup_new_exec(struct linux_binprm * bprm); |
| 101 | extern void would_dump(struct linux_binprm *, struct file *); | 101 | extern void would_dump(struct linux_binprm *, struct file *); |
diff --git a/include/linux/compat.h b/include/linux/compat.h index d0ced1011f2f..784ebfe63c48 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h | |||
| @@ -284,12 +284,8 @@ asmlinkage ssize_t compat_sys_pwritev(unsigned long fd, | |||
| 284 | const struct compat_iovec __user *vec, | 284 | const struct compat_iovec __user *vec, |
| 285 | unsigned long vlen, u32 pos_low, u32 pos_high); | 285 | unsigned long vlen, u32 pos_low, u32 pos_high); |
| 286 | 286 | ||
| 287 | int compat_do_execve(const char *filename, const compat_uptr_t __user *argv, | ||
| 288 | const compat_uptr_t __user *envp, struct pt_regs *regs); | ||
| 289 | #ifdef __ARCH_WANT_SYS_EXECVE | ||
| 290 | asmlinkage long compat_sys_execve(const char __user *filename, const compat_uptr_t __user *argv, | 287 | asmlinkage long compat_sys_execve(const char __user *filename, const compat_uptr_t __user *argv, |
| 291 | const compat_uptr_t __user *envp); | 288 | const compat_uptr_t __user *envp); |
| 292 | #endif | ||
| 293 | 289 | ||
| 294 | asmlinkage long compat_sys_select(int n, compat_ulong_t __user *inp, | 290 | asmlinkage long compat_sys_select(int n, compat_ulong_t __user *inp, |
| 295 | compat_ulong_t __user *outp, compat_ulong_t __user *exp, | 291 | compat_ulong_t __user *outp, compat_ulong_t __user *exp, |
diff --git a/include/linux/coredump.h b/include/linux/coredump.h index 1d7399314a89..a98f1ca60407 100644 --- a/include/linux/coredump.h +++ b/include/linux/coredump.h | |||
| @@ -13,9 +13,9 @@ | |||
| 13 | extern int dump_write(struct file *file, const void *addr, int nr); | 13 | extern int dump_write(struct file *file, const void *addr, int nr); |
| 14 | extern int dump_seek(struct file *file, loff_t off); | 14 | extern int dump_seek(struct file *file, loff_t off); |
| 15 | #ifdef CONFIG_COREDUMP | 15 | #ifdef CONFIG_COREDUMP |
| 16 | extern void do_coredump(siginfo_t *siginfo, struct pt_regs *regs); | 16 | extern void do_coredump(siginfo_t *siginfo); |
| 17 | #else | 17 | #else |
| 18 | static inline void do_coredump(siginfo_t *siginfo, struct pt_regs *regs) {} | 18 | static inline void do_coredump(siginfo_t *siginfo) {} |
| 19 | #endif | 19 | #endif |
| 20 | 20 | ||
| 21 | #endif /* _LINUX_COREDUMP_H */ | 21 | #endif /* _LINUX_COREDUMP_H */ |
diff --git a/include/linux/fdtable.h b/include/linux/fdtable.h index 45052aa814c8..fb7dacae0522 100644 --- a/include/linux/fdtable.h +++ b/include/linux/fdtable.h | |||
| @@ -95,7 +95,6 @@ struct task_struct; | |||
| 95 | struct files_struct *get_files_struct(struct task_struct *); | 95 | struct files_struct *get_files_struct(struct task_struct *); |
| 96 | void put_files_struct(struct files_struct *fs); | 96 | void put_files_struct(struct files_struct *fs); |
| 97 | void reset_files_struct(struct files_struct *); | 97 | void reset_files_struct(struct files_struct *); |
| 98 | void daemonize_descriptors(void); | ||
| 99 | int unshare_files(struct files_struct **); | 98 | int unshare_files(struct files_struct **); |
| 100 | struct files_struct *dup_fd(struct files_struct *, int *); | 99 | struct files_struct *dup_fd(struct files_struct *, int *); |
| 101 | void do_close_on_exec(struct files_struct *); | 100 | void do_close_on_exec(struct files_struct *); |
diff --git a/include/linux/fs_struct.h b/include/linux/fs_struct.h index 003dc0fd7347..d0ae3a84bcfb 100644 --- a/include/linux/fs_struct.h +++ b/include/linux/fs_struct.h | |||
| @@ -21,7 +21,6 @@ extern void set_fs_root(struct fs_struct *, struct path *); | |||
| 21 | extern void set_fs_pwd(struct fs_struct *, struct path *); | 21 | extern void set_fs_pwd(struct fs_struct *, struct path *); |
| 22 | extern struct fs_struct *copy_fs_struct(struct fs_struct *); | 22 | extern struct fs_struct *copy_fs_struct(struct fs_struct *); |
| 23 | extern void free_fs_struct(struct fs_struct *); | 23 | extern void free_fs_struct(struct fs_struct *); |
| 24 | extern void daemonize_fs_struct(void); | ||
| 25 | extern int unshare_fs_struct(void); | 24 | extern int unshare_fs_struct(void); |
| 26 | 25 | ||
| 27 | static inline void get_fs_root(struct fs_struct *fs, struct path *root) | 26 | static inline void get_fs_root(struct fs_struct *fs, struct path *root) |
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h index e0ff4689d35a..a89ff04bddd9 100644 --- a/include/linux/ptrace.h +++ b/include/linux/ptrace.h | |||
| @@ -329,6 +329,19 @@ static inline void user_single_step_siginfo(struct task_struct *tsk, | |||
| 329 | #define current_pt_regs() task_pt_regs(current) | 329 | #define current_pt_regs() task_pt_regs(current) |
| 330 | #endif | 330 | #endif |
| 331 | 331 | ||
| 332 | #ifndef ptrace_signal_deliver | ||
| 333 | #define ptrace_signal_deliver() ((void)0) | ||
| 334 | #endif | ||
| 335 | |||
| 336 | /* | ||
| 337 | * unlike current_pt_regs(), this one is equal to task_pt_regs(current) | ||
| 338 | * on *all* architectures; the only reason to have a per-arch definition | ||
| 339 | * is optimisation. | ||
| 340 | */ | ||
| 341 | #ifndef signal_pt_regs | ||
| 342 | #define signal_pt_regs() task_pt_regs(current) | ||
| 343 | #endif | ||
| 344 | |||
| 332 | extern int task_current_syscall(struct task_struct *target, long *callno, | 345 | extern int task_current_syscall(struct task_struct *target, long *callno, |
| 333 | unsigned long args[6], unsigned int maxargs, | 346 | unsigned long args[6], unsigned int maxargs, |
| 334 | unsigned long *sp, unsigned long *pc); | 347 | unsigned long *sp, unsigned long *pc); |
diff --git a/include/linux/sched.h b/include/linux/sched.h index b96ff1e43ada..651b51a36711 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
| @@ -2303,7 +2303,7 @@ extern void mm_release(struct task_struct *, struct mm_struct *); | |||
| 2303 | extern struct mm_struct *dup_mm(struct task_struct *tsk); | 2303 | extern struct mm_struct *dup_mm(struct task_struct *tsk); |
| 2304 | 2304 | ||
| 2305 | extern int copy_thread(unsigned long, unsigned long, unsigned long, | 2305 | extern int copy_thread(unsigned long, unsigned long, unsigned long, |
| 2306 | struct task_struct *, struct pt_regs *); | 2306 | struct task_struct *); |
| 2307 | extern void flush_thread(void); | 2307 | extern void flush_thread(void); |
| 2308 | extern void exit_thread(void); | 2308 | extern void exit_thread(void); |
| 2309 | 2309 | ||
| @@ -2315,14 +2315,13 @@ extern void flush_itimer_signals(void); | |||
| 2315 | 2315 | ||
| 2316 | extern void do_group_exit(int); | 2316 | extern void do_group_exit(int); |
| 2317 | 2317 | ||
| 2318 | extern void daemonize(const char *, ...); | ||
| 2319 | extern int allow_signal(int); | 2318 | extern int allow_signal(int); |
| 2320 | extern int disallow_signal(int); | 2319 | extern int disallow_signal(int); |
| 2321 | 2320 | ||
| 2322 | extern int do_execve(const char *, | 2321 | extern int do_execve(const char *, |
| 2323 | const char __user * const __user *, | 2322 | const char __user * const __user *, |
| 2324 | const char __user * const __user *, struct pt_regs *); | 2323 | const char __user * const __user *); |
| 2325 | extern long do_fork(unsigned long, unsigned long, struct pt_regs *, unsigned long, int __user *, int __user *); | 2324 | extern long do_fork(unsigned long, unsigned long, unsigned long, int __user *, int __user *); |
| 2326 | struct task_struct *fork_idle(int); | 2325 | struct task_struct *fork_idle(int); |
| 2327 | #ifdef CONFIG_GENERIC_KERNEL_THREAD | 2326 | #ifdef CONFIG_GENERIC_KERNEL_THREAD |
| 2328 | extern pid_t kernel_thread(int (*fn)(void *), void *arg, unsigned long flags); | 2327 | extern pid_t kernel_thread(int (*fn)(void *), void *arg, unsigned long flags); |
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index 727f0cd73921..91835e7f364d 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h | |||
| @@ -833,10 +833,22 @@ int kernel_execve(const char *filename, const char *const argv[], const char *co | |||
| 833 | #define kernel_execve(filename, argv, envp) \ | 833 | #define kernel_execve(filename, argv, envp) \ |
| 834 | do_execve(filename, \ | 834 | do_execve(filename, \ |
| 835 | (const char __user *const __user *)argv, \ | 835 | (const char __user *const __user *)argv, \ |
| 836 | (const char __user *const __user *)envp, \ | 836 | (const char __user *const __user *)envp) |
| 837 | current_pt_regs()) | ||
| 838 | #endif | 837 | #endif |
| 839 | 838 | ||
| 839 | asmlinkage long sys_fork(void); | ||
| 840 | asmlinkage long sys_vfork(void); | ||
| 841 | #ifdef CONFIG_CLONE_BACKWARDS | ||
| 842 | asmlinkage long sys_clone(unsigned long, unsigned long, int __user *, int, | ||
| 843 | int __user *); | ||
| 844 | #else | ||
| 845 | asmlinkage long sys_clone(unsigned long, unsigned long, int __user *, | ||
| 846 | int __user *, int); | ||
| 847 | #endif | ||
| 848 | |||
| 849 | asmlinkage long sys_execve(const char __user *filename, | ||
| 850 | const char __user *const __user *argv, | ||
| 851 | const char __user *const __user *envp); | ||
| 840 | 852 | ||
| 841 | asmlinkage long sys_perf_event_open( | 853 | asmlinkage long sys_perf_event_open( |
| 842 | struct perf_event_attr __user *attr_uptr, | 854 | struct perf_event_attr __user *attr_uptr, |
