aboutsummaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2012-11-20 14:24:26 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2012-12-19 18:07:41 -0500
commitc40702c49faef05ae324f121d8b3e215244ee152 (patch)
treeb0b2a51b07e944497da5cb48fb461963a3762cad /kernel
parent9026843952adac5b123c7b8dc961e5c15828d9e1 (diff)
new helpers: __save_altstack/__compat_save_altstack, switch x86 and um to those
note that they are relying on access_ok() already checked by caller. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/signal.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/kernel/signal.c b/kernel/signal.c
index aee85bd76b8..f072513302c 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -3117,6 +3117,14 @@ int restore_altstack(const stack_t __user *uss)
return err == -EFAULT ? err : 0;
}
+int __save_altstack(stack_t __user *uss, unsigned long sp)
+{
+ struct task_struct *t = current;
+ return __put_user((void __user *)t->sas_ss_sp, &uss->ss_sp) |
+ __put_user(sas_ss_flags(sp), &uss->ss_flags) |
+ __put_user(t->sas_ss_size, &uss->ss_size);
+}
+
#ifdef CONFIG_COMPAT
#ifdef CONFIG_GENERIC_SIGALTSTACK
asmlinkage long compat_sys_sigaltstack(const compat_stack_t __user *uss_ptr,
@@ -3158,6 +3166,14 @@ int compat_restore_altstack(const compat_stack_t __user *uss)
/* squash all but -EFAULT for now */
return err == -EFAULT ? err : 0;
}
+
+int __compat_save_altstack(compat_stack_t __user *uss, unsigned long sp)
+{
+ struct task_struct *t = current;
+ return __put_user(ptr_to_compat((void __user *)t->sas_ss_sp), &uss->ss_sp) |
+ __put_user(sas_ss_flags(sp), &uss->ss_flags) |
+ __put_user(t->sas_ss_size, &uss->ss_size);
+}
#endif
#endif