aboutsummaryrefslogtreecommitdiffstats
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 aee85bd76b8a..f072513302c3 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -3117,6 +3117,14 @@ int restore_altstack(const stack_t __user *uss)
3117 return err == -EFAULT ? err : 0; 3117 return err == -EFAULT ? err : 0;
3118} 3118}
3119 3119
3120int __save_altstack(stack_t __user *uss, unsigned long sp)
3121{
3122 struct task_struct *t = current;
3123 return __put_user((void __user *)t->sas_ss_sp, &uss->ss_sp) |
3124 __put_user(sas_ss_flags(sp), &uss->ss_flags) |
3125 __put_user(t->sas_ss_size, &uss->ss_size);
3126}
3127
3120#ifdef CONFIG_COMPAT 3128#ifdef CONFIG_COMPAT
3121#ifdef CONFIG_GENERIC_SIGALTSTACK 3129#ifdef CONFIG_GENERIC_SIGALTSTACK
3122asmlinkage long compat_sys_sigaltstack(const compat_stack_t __user *uss_ptr, 3130asmlinkage 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)
3158 /* squash all but -EFAULT for now */ 3166 /* squash all but -EFAULT for now */
3159 return err == -EFAULT ? err : 0; 3167 return err == -EFAULT ? err : 0;
3160} 3168}
3169
3170int __compat_save_altstack(compat_stack_t __user *uss, unsigned long sp)
3171{
3172 struct task_struct *t = current;
3173 return __put_user(ptr_to_compat((void __user *)t->sas_ss_sp), &uss->ss_sp) |
3174 __put_user(sas_ss_flags(sp), &uss->ss_flags) |
3175 __put_user(t->sas_ss_size, &uss->ss_size);
3176}
3161#endif 3177#endif
3162#endif 3178#endif
3163 3179