diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2012-11-20 14:24:26 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-12-19 18:07:41 -0500 |
commit | c40702c49faef05ae324f121d8b3e215244ee152 (patch) | |
tree | b0b2a51b07e944497da5cb48fb461963a3762cad /kernel | |
parent | 9026843952adac5b123c7b8dc961e5c15828d9e1 (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.c | 16 |
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 | ||
3120 | int __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 |
3122 | asmlinkage long compat_sys_sigaltstack(const compat_stack_t __user *uss_ptr, | 3130 | 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) | |||
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 | |||
3170 | int __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 | ||