aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-12-12 15:22:13 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-12-12 15:22:13 -0500
commit9977d9b379cb77e0f67bd6f4563618106e58e11d (patch)
tree0191accfddf578edb52c69c933d64521e3dce297 /include/linux
parentcf4af01221579a4e895f43dbfc47598fbfc5a731 (diff)
parent541880d9a2c7871f6370071d55aa6662d329c51e (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.h4
-rw-r--r--include/linux/compat.h4
-rw-r--r--include/linux/coredump.h4
-rw-r--r--include/linux/fdtable.h1
-rw-r--r--include/linux/fs_struct.h1
-rw-r--r--include/linux/ptrace.h13
-rw-r--r--include/linux/sched.h7
-rw-r--r--include/linux/syscalls.h16
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 {
72struct linux_binfmt { 72struct 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
96extern int prepare_binprm(struct linux_binprm *); 96extern int prepare_binprm(struct linux_binprm *);
97extern int __must_check remove_arg_zero(struct linux_binprm *); 97extern int __must_check remove_arg_zero(struct linux_binprm *);
98extern int search_binary_handler(struct linux_binprm *, struct pt_regs *); 98extern int search_binary_handler(struct linux_binprm *);
99extern int flush_old_exec(struct linux_binprm * bprm); 99extern int flush_old_exec(struct linux_binprm * bprm);
100extern void setup_new_exec(struct linux_binprm * bprm); 100extern void setup_new_exec(struct linux_binprm * bprm);
101extern void would_dump(struct linux_binprm *, struct file *); 101extern 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
287int 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
290asmlinkage long compat_sys_execve(const char __user *filename, const compat_uptr_t __user *argv, 287asmlinkage 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
294asmlinkage long compat_sys_select(int n, compat_ulong_t __user *inp, 290asmlinkage 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 @@
13extern int dump_write(struct file *file, const void *addr, int nr); 13extern int dump_write(struct file *file, const void *addr, int nr);
14extern int dump_seek(struct file *file, loff_t off); 14extern int dump_seek(struct file *file, loff_t off);
15#ifdef CONFIG_COREDUMP 15#ifdef CONFIG_COREDUMP
16extern void do_coredump(siginfo_t *siginfo, struct pt_regs *regs); 16extern void do_coredump(siginfo_t *siginfo);
17#else 17#else
18static inline void do_coredump(siginfo_t *siginfo, struct pt_regs *regs) {} 18static 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;
95struct files_struct *get_files_struct(struct task_struct *); 95struct files_struct *get_files_struct(struct task_struct *);
96void put_files_struct(struct files_struct *fs); 96void put_files_struct(struct files_struct *fs);
97void reset_files_struct(struct files_struct *); 97void reset_files_struct(struct files_struct *);
98void daemonize_descriptors(void);
99int unshare_files(struct files_struct **); 98int unshare_files(struct files_struct **);
100struct files_struct *dup_fd(struct files_struct *, int *); 99struct files_struct *dup_fd(struct files_struct *, int *);
101void do_close_on_exec(struct files_struct *); 100void 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 *);
21extern void set_fs_pwd(struct fs_struct *, struct path *); 21extern void set_fs_pwd(struct fs_struct *, struct path *);
22extern struct fs_struct *copy_fs_struct(struct fs_struct *); 22extern struct fs_struct *copy_fs_struct(struct fs_struct *);
23extern void free_fs_struct(struct fs_struct *); 23extern void free_fs_struct(struct fs_struct *);
24extern void daemonize_fs_struct(void);
25extern int unshare_fs_struct(void); 24extern int unshare_fs_struct(void);
26 25
27static inline void get_fs_root(struct fs_struct *fs, struct path *root) 26static 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
332extern int task_current_syscall(struct task_struct *target, long *callno, 345extern 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 *);
2303extern struct mm_struct *dup_mm(struct task_struct *tsk); 2303extern struct mm_struct *dup_mm(struct task_struct *tsk);
2304 2304
2305extern int copy_thread(unsigned long, unsigned long, unsigned long, 2305extern int copy_thread(unsigned long, unsigned long, unsigned long,
2306 struct task_struct *, struct pt_regs *); 2306 struct task_struct *);
2307extern void flush_thread(void); 2307extern void flush_thread(void);
2308extern void exit_thread(void); 2308extern void exit_thread(void);
2309 2309
@@ -2315,14 +2315,13 @@ extern void flush_itimer_signals(void);
2315 2315
2316extern void do_group_exit(int); 2316extern void do_group_exit(int);
2317 2317
2318extern void daemonize(const char *, ...);
2319extern int allow_signal(int); 2318extern int allow_signal(int);
2320extern int disallow_signal(int); 2319extern int disallow_signal(int);
2321 2320
2322extern int do_execve(const char *, 2321extern 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 *);
2325extern long do_fork(unsigned long, unsigned long, struct pt_regs *, unsigned long, int __user *, int __user *); 2324extern long do_fork(unsigned long, unsigned long, unsigned long, int __user *, int __user *);
2326struct task_struct *fork_idle(int); 2325struct task_struct *fork_idle(int);
2327#ifdef CONFIG_GENERIC_KERNEL_THREAD 2326#ifdef CONFIG_GENERIC_KERNEL_THREAD
2328extern pid_t kernel_thread(int (*fn)(void *), void *arg, unsigned long flags); 2327extern 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
839asmlinkage long sys_fork(void);
840asmlinkage long sys_vfork(void);
841#ifdef CONFIG_CLONE_BACKWARDS
842asmlinkage long sys_clone(unsigned long, unsigned long, int __user *, int,
843 int __user *);
844#else
845asmlinkage long sys_clone(unsigned long, unsigned long, int __user *,
846 int __user *, int);
847#endif
848
849asmlinkage long sys_execve(const char __user *filename,
850 const char __user *const __user *argv,
851 const char __user *const __user *envp);
840 852
841asmlinkage long sys_perf_event_open( 853asmlinkage long sys_perf_event_open(
842 struct perf_event_attr __user *attr_uptr, 854 struct perf_event_attr __user *attr_uptr,