diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-02-23 21:50:11 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-02-23 21:50:11 -0500 |
commit | 9e2d59ad580d590134285f361a0e80f0e98c0207 (patch) | |
tree | f3232be75781484193413f32ec82c21f6d8eb76e /kernel/compat.c | |
parent | 5ce1a70e2f00f0bce0cab57f798ca354b9496169 (diff) | |
parent | 235b80226b986dabcbba844968f7807866bd0bfe (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal
Pull signal handling cleanups from Al Viro:
"This is the first pile; another one will come a bit later and will
contain SYSCALL_DEFINE-related patches.
- a bunch of signal-related syscalls (both native and compat)
unified.
- a bunch of compat syscalls switched to COMPAT_SYSCALL_DEFINE
(fixing several potential problems with missing argument
validation, while we are at it)
- a lot of now-pointless wrappers killed
- a couple of architectures (cris and hexagon) forgot to save
altstack settings into sigframe, even though they used the
(uninitialized) values in sigreturn; fixed.
- microblaze fixes for delivery of multiple signals arriving at once
- saner set of helpers for signal delivery introduced, several
architectures switched to using those."
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal: (143 commits)
x86: convert to ksignal
sparc: convert to ksignal
arm: switch to struct ksignal * passing
alpha: pass k_sigaction and siginfo_t using ksignal pointer
burying unused conditionals
make do_sigaltstack() static
arm64: switch to generic old sigaction() (compat-only)
arm64: switch to generic compat rt_sigaction()
arm64: switch compat to generic old sigsuspend
arm64: switch to generic compat rt_sigqueueinfo()
arm64: switch to generic compat rt_sigpending()
arm64: switch to generic compat rt_sigprocmask()
arm64: switch to generic sigaltstack
sparc: switch to generic old sigsuspend
sparc: COMPAT_SYSCALL_DEFINE does all sign-extension as well as SYSCALL_DEFINE
sparc: kill sign-extending wrappers for native syscalls
kill sparc32_open()
sparc: switch to use of generic old sigaction
sparc: switch sys_compat_rt_sigaction() to COMPAT_SYSCALL_DEFINE
mips: switch to generic sys_fork() and sys_clone()
...
Diffstat (limited to 'kernel/compat.c')
-rw-r--r-- | kernel/compat.c | 72 |
1 files changed, 26 insertions, 46 deletions
diff --git a/kernel/compat.c b/kernel/compat.c index f4bddb900186..19971d8c7299 100644 --- a/kernel/compat.c +++ b/kernel/compat.c | |||
@@ -290,8 +290,8 @@ static inline long put_compat_itimerval(struct compat_itimerval __user *o, | |||
290 | __put_user(i->it_value.tv_usec, &o->it_value.tv_usec))); | 290 | __put_user(i->it_value.tv_usec, &o->it_value.tv_usec))); |
291 | } | 291 | } |
292 | 292 | ||
293 | asmlinkage long compat_sys_getitimer(int which, | 293 | COMPAT_SYSCALL_DEFINE2(getitimer, int, which, |
294 | struct compat_itimerval __user *it) | 294 | struct compat_itimerval __user *, it) |
295 | { | 295 | { |
296 | struct itimerval kit; | 296 | struct itimerval kit; |
297 | int error; | 297 | int error; |
@@ -302,9 +302,9 @@ asmlinkage long compat_sys_getitimer(int which, | |||
302 | return error; | 302 | return error; |
303 | } | 303 | } |
304 | 304 | ||
305 | asmlinkage long compat_sys_setitimer(int which, | 305 | COMPAT_SYSCALL_DEFINE3(setitimer, int, which, |
306 | struct compat_itimerval __user *in, | 306 | struct compat_itimerval __user *, in, |
307 | struct compat_itimerval __user *out) | 307 | struct compat_itimerval __user *, out) |
308 | { | 308 | { |
309 | struct itimerval kin, kout; | 309 | struct itimerval kin, kout; |
310 | int error; | 310 | int error; |
@@ -381,9 +381,9 @@ static inline void compat_sig_setmask(sigset_t *blocked, compat_sigset_word set) | |||
381 | memcpy(blocked->sig, &set, sizeof(set)); | 381 | memcpy(blocked->sig, &set, sizeof(set)); |
382 | } | 382 | } |
383 | 383 | ||
384 | asmlinkage long compat_sys_sigprocmask(int how, | 384 | COMPAT_SYSCALL_DEFINE3(sigprocmask, int, how, |
385 | compat_old_sigset_t __user *nset, | 385 | compat_old_sigset_t __user *, nset, |
386 | compat_old_sigset_t __user *oset) | 386 | compat_old_sigset_t __user *, oset) |
387 | { | 387 | { |
388 | old_sigset_t old_set, new_set; | 388 | old_sigset_t old_set, new_set; |
389 | sigset_t new_blocked; | 389 | sigset_t new_blocked; |
@@ -971,7 +971,7 @@ long compat_put_bitmap(compat_ulong_t __user *umask, unsigned long *mask, | |||
971 | } | 971 | } |
972 | 972 | ||
973 | void | 973 | void |
974 | sigset_from_compat (sigset_t *set, compat_sigset_t *compat) | 974 | sigset_from_compat(sigset_t *set, const compat_sigset_t *compat) |
975 | { | 975 | { |
976 | switch (_NSIG_WORDS) { | 976 | switch (_NSIG_WORDS) { |
977 | case 4: set->sig[3] = compat->sig[6] | (((long)compat->sig[7]) << 32 ); | 977 | case 4: set->sig[3] = compat->sig[6] | (((long)compat->sig[7]) << 32 ); |
@@ -982,10 +982,20 @@ sigset_from_compat (sigset_t *set, compat_sigset_t *compat) | |||
982 | } | 982 | } |
983 | EXPORT_SYMBOL_GPL(sigset_from_compat); | 983 | EXPORT_SYMBOL_GPL(sigset_from_compat); |
984 | 984 | ||
985 | asmlinkage long | 985 | void |
986 | compat_sys_rt_sigtimedwait (compat_sigset_t __user *uthese, | 986 | sigset_to_compat(compat_sigset_t *compat, const sigset_t *set) |
987 | struct compat_siginfo __user *uinfo, | 987 | { |
988 | struct compat_timespec __user *uts, compat_size_t sigsetsize) | 988 | switch (_NSIG_WORDS) { |
989 | case 4: compat->sig[7] = (set->sig[3] >> 32); compat->sig[6] = set->sig[3]; | ||
990 | case 3: compat->sig[5] = (set->sig[2] >> 32); compat->sig[4] = set->sig[2]; | ||
991 | case 2: compat->sig[3] = (set->sig[1] >> 32); compat->sig[2] = set->sig[1]; | ||
992 | case 1: compat->sig[1] = (set->sig[0] >> 32); compat->sig[0] = set->sig[0]; | ||
993 | } | ||
994 | } | ||
995 | |||
996 | COMPAT_SYSCALL_DEFINE4(rt_sigtimedwait, compat_sigset_t __user *, uthese, | ||
997 | struct compat_siginfo __user *, uinfo, | ||
998 | struct compat_timespec __user *, uts, compat_size_t, sigsetsize) | ||
989 | { | 999 | { |
990 | compat_sigset_t s32; | 1000 | compat_sigset_t s32; |
991 | sigset_t s; | 1001 | sigset_t s; |
@@ -1013,18 +1023,6 @@ compat_sys_rt_sigtimedwait (compat_sigset_t __user *uthese, | |||
1013 | } | 1023 | } |
1014 | 1024 | ||
1015 | return ret; | 1025 | return ret; |
1016 | |||
1017 | } | ||
1018 | |||
1019 | asmlinkage long | ||
1020 | compat_sys_rt_tgsigqueueinfo(compat_pid_t tgid, compat_pid_t pid, int sig, | ||
1021 | struct compat_siginfo __user *uinfo) | ||
1022 | { | ||
1023 | siginfo_t info; | ||
1024 | |||
1025 | if (copy_siginfo_from_user32(&info, uinfo)) | ||
1026 | return -EFAULT; | ||
1027 | return do_rt_tgsigqueueinfo(tgid, pid, sig, &info); | ||
1028 | } | 1026 | } |
1029 | 1027 | ||
1030 | #ifdef __ARCH_WANT_COMPAT_SYS_TIME | 1028 | #ifdef __ARCH_WANT_COMPAT_SYS_TIME |
@@ -1067,23 +1065,6 @@ asmlinkage long compat_sys_stime(compat_time_t __user *tptr) | |||
1067 | 1065 | ||
1068 | #endif /* __ARCH_WANT_COMPAT_SYS_TIME */ | 1066 | #endif /* __ARCH_WANT_COMPAT_SYS_TIME */ |
1069 | 1067 | ||
1070 | #ifdef __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND | ||
1071 | asmlinkage long compat_sys_rt_sigsuspend(compat_sigset_t __user *unewset, compat_size_t sigsetsize) | ||
1072 | { | ||
1073 | sigset_t newset; | ||
1074 | compat_sigset_t newset32; | ||
1075 | |||
1076 | /* XXX: Don't preclude handling different sized sigset_t's. */ | ||
1077 | if (sigsetsize != sizeof(sigset_t)) | ||
1078 | return -EINVAL; | ||
1079 | |||
1080 | if (copy_from_user(&newset32, unewset, sizeof(compat_sigset_t))) | ||
1081 | return -EFAULT; | ||
1082 | sigset_from_compat(&newset, &newset32); | ||
1083 | return sigsuspend(&newset); | ||
1084 | } | ||
1085 | #endif /* __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND */ | ||
1086 | |||
1087 | asmlinkage long compat_sys_adjtimex(struct compat_timex __user *utp) | 1068 | asmlinkage long compat_sys_adjtimex(struct compat_timex __user *utp) |
1088 | { | 1069 | { |
1089 | struct timex txc; | 1070 | struct timex txc; |
@@ -1222,9 +1203,9 @@ compat_sys_sysinfo(struct compat_sysinfo __user *info) | |||
1222 | return 0; | 1203 | return 0; |
1223 | } | 1204 | } |
1224 | 1205 | ||
1225 | #ifdef __ARCH_WANT_COMPAT_SYS_SCHED_RR_GET_INTERVAL | 1206 | COMPAT_SYSCALL_DEFINE2(sched_rr_get_interval, |
1226 | asmlinkage long compat_sys_sched_rr_get_interval(compat_pid_t pid, | 1207 | compat_pid_t, pid, |
1227 | struct compat_timespec __user *interval) | 1208 | struct compat_timespec __user *, interval) |
1228 | { | 1209 | { |
1229 | struct timespec t; | 1210 | struct timespec t; |
1230 | int ret; | 1211 | int ret; |
@@ -1237,7 +1218,6 @@ asmlinkage long compat_sys_sched_rr_get_interval(compat_pid_t pid, | |||
1237 | return -EFAULT; | 1218 | return -EFAULT; |
1238 | return ret; | 1219 | return ret; |
1239 | } | 1220 | } |
1240 | #endif /* __ARCH_WANT_COMPAT_SYS_SCHED_RR_GET_INTERVAL */ | ||
1241 | 1221 | ||
1242 | /* | 1222 | /* |
1243 | * Allocate user-space memory for the duration of a single system call, | 1223 | * Allocate user-space memory for the duration of a single system call, |