diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-20 21:05:28 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-20 21:05:28 -0500 |
commit | 54d46ea993744c5408e39ce0cb4851e13cbea716 (patch) | |
tree | 8e38fa92cc2ae72e0353c44e1e68be9bf5a7a058 /include | |
parent | f59dc2bb5a50b26ea751f9eac1c81e4cc7de5257 (diff) | |
parent | 50ececcfa7d1acee085b2c518cad495062db6379 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal
Pull signal handling cleanups from Al Viro:
"sigaltstack infrastructure + conversion for x86, alpha and um,
COMPAT_SYSCALL_DEFINE infrastructure.
Note that there are several conflicts between "unify
SS_ONSTACK/SS_DISABLE definitions" and UAPI patches in mainline;
resolution is trivial - just remove definitions of SS_ONSTACK and
SS_DISABLED from arch/*/uapi/asm/signal.h; they are all identical and
include/uapi/linux/signal.h contains the unified variant."
Fixed up conflicts as per Al.
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal:
alpha: switch to generic sigaltstack
new helpers: __save_altstack/__compat_save_altstack, switch x86 and um to those
generic compat_sys_sigaltstack()
introduce generic sys_sigaltstack(), switch x86 and um to it
new helper: compat_user_stack_pointer()
new helper: restore_altstack()
unify SS_ONSTACK/SS_DISABLE definitions
new helper: current_user_stack_pointer()
missing user_stack_pointer() instances
Bury the conditionals from kernel_thread/kernel_execve series
COMPAT_SYSCALL_DEFINE: infrastructure
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/binfmts.h | 4 | ||||
-rw-r--r-- | include/linux/compat.h | 62 | ||||
-rw-r--r-- | include/linux/ptrace.h | 4 | ||||
-rw-r--r-- | include/linux/sched.h | 2 | ||||
-rw-r--r-- | include/linux/signal.h | 3 | ||||
-rw-r--r-- | include/linux/syscalls.h | 15 | ||||
-rw-r--r-- | include/uapi/asm-generic/signal.h | 6 | ||||
-rw-r--r-- | include/uapi/linux/signal.h | 2 |
8 files changed, 77 insertions, 21 deletions
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h index a4c2b565c835..cf3eae0b4f59 100644 --- a/include/linux/binfmts.h +++ b/include/linux/binfmts.h | |||
@@ -119,8 +119,4 @@ extern void install_exec_creds(struct linux_binprm *bprm); | |||
119 | extern void set_binfmt(struct linux_binfmt *new); | 119 | extern void set_binfmt(struct linux_binfmt *new); |
120 | extern void free_bprm(struct linux_binprm *); | 120 | extern void free_bprm(struct linux_binprm *); |
121 | 121 | ||
122 | #ifdef __ARCH_WANT_KERNEL_EXECVE | ||
123 | extern void ret_from_kernel_execve(struct pt_regs *normal) __noreturn; | ||
124 | #endif | ||
125 | |||
126 | #endif /* _LINUX_BINFMTS_H */ | 122 | #endif /* _LINUX_BINFMTS_H */ |
diff --git a/include/linux/compat.h b/include/linux/compat.h index e4920bd58a47..dec7e2d18875 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h | |||
@@ -23,6 +23,61 @@ | |||
23 | #define COMPAT_USE_64BIT_TIME 0 | 23 | #define COMPAT_USE_64BIT_TIME 0 |
24 | #endif | 24 | #endif |
25 | 25 | ||
26 | #ifndef __SC_DELOUSE | ||
27 | #define __SC_DELOUSE(t,v) ((t)(unsigned long)(v)) | ||
28 | #endif | ||
29 | |||
30 | #define __SC_CCAST1(t1, a1) __SC_DELOUSE(t1,a1) | ||
31 | #define __SC_CCAST2(t2, a2, ...) __SC_DELOUSE(t2,a2), __SC_CCAST1(__VA_ARGS__) | ||
32 | #define __SC_CCAST3(t3, a3, ...) __SC_DELOUSE(t3,a3), __SC_CCAST2(__VA_ARGS__) | ||
33 | #define __SC_CCAST4(t4, a4, ...) __SC_DELOUSE(t4,a4), __SC_CCAST3(__VA_ARGS__) | ||
34 | #define __SC_CCAST5(t5, a5, ...) __SC_DELOUSE(t5,a5), __SC_CCAST4(__VA_ARGS__) | ||
35 | #define __SC_CCAST6(t6, a6, ...) __SC_DELOUSE(t6,a6), __SC_CCAST5(__VA_ARGS__) | ||
36 | #define COMPAT_SYSCALL_DEFINE1(name, ...) \ | ||
37 | COMPAT_SYSCALL_DEFINEx(1, _##name, __VA_ARGS__) | ||
38 | #define COMPAT_SYSCALL_DEFINE2(name, ...) \ | ||
39 | COMPAT_SYSCALL_DEFINEx(2, _##name, __VA_ARGS__) | ||
40 | #define COMPAT_SYSCALL_DEFINE3(name, ...) \ | ||
41 | COMPAT_SYSCALL_DEFINEx(3, _##name, __VA_ARGS__) | ||
42 | #define COMPAT_SYSCALL_DEFINE4(name, ...) \ | ||
43 | COMPAT_SYSCALL_DEFINEx(4, _##name, __VA_ARGS__) | ||
44 | #define COMPAT_SYSCALL_DEFINE5(name, ...) \ | ||
45 | COMPAT_SYSCALL_DEFINEx(5, _##name, __VA_ARGS__) | ||
46 | #define COMPAT_SYSCALL_DEFINE6(name, ...) \ | ||
47 | COMPAT_SYSCALL_DEFINEx(6, _##name, __VA_ARGS__) | ||
48 | |||
49 | #ifdef CONFIG_HAVE_SYSCALL_WRAPPERS | ||
50 | |||
51 | #define COMPAT_SYSCALL_DEFINEx(x, name, ...) \ | ||
52 | asmlinkage long compat_sys##name(__SC_DECL##x(__VA_ARGS__)); \ | ||
53 | static inline long C_SYSC##name(__SC_DECL##x(__VA_ARGS__)); \ | ||
54 | asmlinkage long compat_SyS##name(__SC_LONG##x(__VA_ARGS__)) \ | ||
55 | { \ | ||
56 | return (long) C_SYSC##name(__SC_CCAST##x(__VA_ARGS__)); \ | ||
57 | } \ | ||
58 | SYSCALL_ALIAS(compat_sys##name, compat_SyS##name); \ | ||
59 | static inline long C_SYSC##name(__SC_DECL##x(__VA_ARGS__)) | ||
60 | |||
61 | #else /* CONFIG_HAVE_SYSCALL_WRAPPERS */ | ||
62 | |||
63 | #define COMPAT_SYSCALL_DEFINEx(x, name, ...) \ | ||
64 | asmlinkage long compat_sys##name(__SC_DECL##x(__VA_ARGS__)) | ||
65 | |||
66 | #endif /* CONFIG_HAVE_SYSCALL_WRAPPERS */ | ||
67 | |||
68 | #ifndef compat_user_stack_pointer | ||
69 | #define compat_user_stack_pointer() current_user_stack_pointer() | ||
70 | #endif | ||
71 | #ifdef CONFIG_GENERIC_SIGALTSTACK | ||
72 | #ifndef compat_sigaltstack /* we'll need that for MIPS */ | ||
73 | typedef struct compat_sigaltstack { | ||
74 | compat_uptr_t ss_sp; | ||
75 | int ss_flags; | ||
76 | compat_size_t ss_size; | ||
77 | } compat_stack_t; | ||
78 | #endif | ||
79 | #endif | ||
80 | |||
26 | #define compat_jiffies_to_clock_t(x) \ | 81 | #define compat_jiffies_to_clock_t(x) \ |
27 | (((unsigned long)(x) * COMPAT_USER_HZ) / HZ) | 82 | (((unsigned long)(x) * COMPAT_USER_HZ) / HZ) |
28 | 83 | ||
@@ -587,6 +642,13 @@ asmlinkage ssize_t compat_sys_process_vm_writev(compat_pid_t pid, | |||
587 | 642 | ||
588 | asmlinkage long compat_sys_sendfile(int out_fd, int in_fd, | 643 | asmlinkage long compat_sys_sendfile(int out_fd, int in_fd, |
589 | compat_off_t __user *offset, compat_size_t count); | 644 | compat_off_t __user *offset, compat_size_t count); |
645 | #ifdef CONFIG_GENERIC_SIGALTSTACK | ||
646 | asmlinkage long compat_sys_sigaltstack(const compat_stack_t __user *uss_ptr, | ||
647 | compat_stack_t __user *uoss_ptr); | ||
648 | |||
649 | int compat_restore_altstack(const compat_stack_t __user *uss); | ||
650 | int __compat_save_altstack(compat_stack_t __user *, unsigned long); | ||
651 | #endif | ||
590 | 652 | ||
591 | asmlinkage long compat_sys_sched_rr_get_interval(compat_pid_t pid, | 653 | asmlinkage long compat_sys_sched_rr_get_interval(compat_pid_t pid, |
592 | struct compat_timespec __user *interval); | 654 | struct compat_timespec __user *interval); |
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h index addfbe7c180e..1693775ecfe8 100644 --- a/include/linux/ptrace.h +++ b/include/linux/ptrace.h | |||
@@ -344,6 +344,10 @@ static inline void user_single_step_siginfo(struct task_struct *tsk, | |||
344 | #define signal_pt_regs() task_pt_regs(current) | 344 | #define signal_pt_regs() task_pt_regs(current) |
345 | #endif | 345 | #endif |
346 | 346 | ||
347 | #ifndef current_user_stack_pointer | ||
348 | #define current_user_stack_pointer() user_stack_pointer(current_pt_regs()) | ||
349 | #endif | ||
350 | |||
347 | extern int task_current_syscall(struct task_struct *target, long *callno, | 351 | extern int task_current_syscall(struct task_struct *target, long *callno, |
348 | unsigned long args[6], unsigned int maxargs, | 352 | unsigned long args[6], unsigned int maxargs, |
349 | unsigned long *sp, unsigned long *pc); | 353 | unsigned long *sp, unsigned long *pc); |
diff --git a/include/linux/sched.h b/include/linux/sched.h index f712465b05c5..206bb089c06b 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -2353,9 +2353,7 @@ extern int do_execve(const char *, | |||
2353 | const char __user * const __user *); | 2353 | const char __user * const __user *); |
2354 | extern long do_fork(unsigned long, unsigned long, unsigned long, int __user *, int __user *); | 2354 | extern long do_fork(unsigned long, unsigned long, unsigned long, int __user *, int __user *); |
2355 | struct task_struct *fork_idle(int); | 2355 | struct task_struct *fork_idle(int); |
2356 | #ifdef CONFIG_GENERIC_KERNEL_THREAD | ||
2357 | extern pid_t kernel_thread(int (*fn)(void *), void *arg, unsigned long flags); | 2356 | extern pid_t kernel_thread(int (*fn)(void *), void *arg, unsigned long flags); |
2358 | #endif | ||
2359 | 2357 | ||
2360 | extern void set_task_comm(struct task_struct *tsk, char *from); | 2358 | extern void set_task_comm(struct task_struct *tsk, char *from); |
2361 | extern char *get_task_comm(char *to, struct task_struct *tsk); | 2359 | extern char *get_task_comm(char *to, struct task_struct *tsk); |
diff --git a/include/linux/signal.h b/include/linux/signal.h index e19a011b43b7..0a89ffc48466 100644 --- a/include/linux/signal.h +++ b/include/linux/signal.h | |||
@@ -385,4 +385,7 @@ int unhandled_signal(struct task_struct *tsk, int sig); | |||
385 | 385 | ||
386 | void signals_init(void); | 386 | void signals_init(void); |
387 | 387 | ||
388 | int restore_altstack(const stack_t __user *); | ||
389 | int __save_altstack(stack_t __user *, unsigned long); | ||
390 | |||
388 | #endif /* _LINUX_SIGNAL_H */ | 391 | #endif /* _LINUX_SIGNAL_H */ |
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index 6caee34bf8a2..45e2db270255 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h | |||
@@ -63,6 +63,7 @@ struct getcpu_cache; | |||
63 | struct old_linux_dirent; | 63 | struct old_linux_dirent; |
64 | struct perf_event_attr; | 64 | struct perf_event_attr; |
65 | struct file_handle; | 65 | struct file_handle; |
66 | struct sigaltstack; | ||
66 | 67 | ||
67 | #include <linux/types.h> | 68 | #include <linux/types.h> |
68 | #include <linux/aio_abi.h> | 69 | #include <linux/aio_abi.h> |
@@ -299,6 +300,11 @@ asmlinkage long sys_personality(unsigned int personality); | |||
299 | asmlinkage long sys_sigpending(old_sigset_t __user *set); | 300 | asmlinkage long sys_sigpending(old_sigset_t __user *set); |
300 | asmlinkage long sys_sigprocmask(int how, old_sigset_t __user *set, | 301 | asmlinkage long sys_sigprocmask(int how, old_sigset_t __user *set, |
301 | old_sigset_t __user *oset); | 302 | old_sigset_t __user *oset); |
303 | #ifdef CONFIG_GENERIC_SIGALTSTACK | ||
304 | asmlinkage long sys_sigaltstack(const struct sigaltstack __user *uss, | ||
305 | struct sigaltstack __user *uoss); | ||
306 | #endif | ||
307 | |||
302 | asmlinkage long sys_getitimer(int which, struct itimerval __user *value); | 308 | asmlinkage long sys_getitimer(int which, struct itimerval __user *value); |
303 | asmlinkage long sys_setitimer(int which, | 309 | asmlinkage long sys_setitimer(int which, |
304 | struct itimerval __user *value, | 310 | struct itimerval __user *value, |
@@ -827,15 +833,6 @@ asmlinkage long sys_fanotify_mark(int fanotify_fd, unsigned int flags, | |||
827 | const char __user *pathname); | 833 | const char __user *pathname); |
828 | asmlinkage long sys_syncfs(int fd); | 834 | asmlinkage long sys_syncfs(int fd); |
829 | 835 | ||
830 | #ifndef CONFIG_GENERIC_KERNEL_EXECVE | ||
831 | int kernel_execve(const char *filename, const char *const argv[], const char *const envp[]); | ||
832 | #else | ||
833 | #define kernel_execve(filename, argv, envp) \ | ||
834 | do_execve(filename, \ | ||
835 | (const char __user *const __user *)argv, \ | ||
836 | (const char __user *const __user *)envp) | ||
837 | #endif | ||
838 | |||
839 | asmlinkage long sys_fork(void); | 836 | asmlinkage long sys_fork(void); |
840 | asmlinkage long sys_vfork(void); | 837 | asmlinkage long sys_vfork(void); |
841 | #ifdef CONFIG_CLONE_BACKWARDS | 838 | #ifdef CONFIG_CLONE_BACKWARDS |
diff --git a/include/uapi/asm-generic/signal.h b/include/uapi/asm-generic/signal.h index 0a78028984de..6fae30fd16ab 100644 --- a/include/uapi/asm-generic/signal.h +++ b/include/uapi/asm-generic/signal.h | |||
@@ -80,12 +80,6 @@ | |||
80 | * SA_RESTORER 0x04000000 | 80 | * SA_RESTORER 0x04000000 |
81 | */ | 81 | */ |
82 | 82 | ||
83 | /* | ||
84 | * sigaltstack controls | ||
85 | */ | ||
86 | #define SS_ONSTACK 1 | ||
87 | #define SS_DISABLE 2 | ||
88 | |||
89 | #define MINSIGSTKSZ 2048 | 83 | #define MINSIGSTKSZ 2048 |
90 | #define SIGSTKSZ 8192 | 84 | #define SIGSTKSZ 8192 |
91 | 85 | ||
diff --git a/include/uapi/linux/signal.h b/include/uapi/linux/signal.h index dff452ed6d00..e1bd50c29ded 100644 --- a/include/uapi/linux/signal.h +++ b/include/uapi/linux/signal.h | |||
@@ -4,5 +4,7 @@ | |||
4 | #include <asm/signal.h> | 4 | #include <asm/signal.h> |
5 | #include <asm/siginfo.h> | 5 | #include <asm/siginfo.h> |
6 | 6 | ||
7 | #define SS_ONSTACK 1 | ||
8 | #define SS_DISABLE 2 | ||
7 | 9 | ||
8 | #endif /* _UAPI_LINUX_SIGNAL_H */ | 10 | #endif /* _UAPI_LINUX_SIGNAL_H */ |