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>
This commit is contained in:
@@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user