powerpc/signal32: Switch swap_context() to user_access_begin() logic
As this was the last user of put_sigset_t(), remove it as well. Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/c3ac4f2d134a3391bb51bdaa2d00e9a409aba9f8.1597770847.git.christophe.leroy@csgroup.eu
This commit is contained in:
Родитель
de781ebdf6
Коммит
31147d7d61
|
@ -82,11 +82,6 @@
|
||||||
* Functions for flipping sigsets (thanks to brain dead generic
|
* Functions for flipping sigsets (thanks to brain dead generic
|
||||||
* implementation that makes things simple for little endian only)
|
* implementation that makes things simple for little endian only)
|
||||||
*/
|
*/
|
||||||
static inline int put_sigset_t(compat_sigset_t __user *uset, sigset_t *set)
|
|
||||||
{
|
|
||||||
return put_compat_sigset(uset, set, sizeof(*uset));
|
|
||||||
}
|
|
||||||
|
|
||||||
#define unsafe_put_sigset_t unsafe_put_compat_sigset
|
#define unsafe_put_sigset_t unsafe_put_compat_sigset
|
||||||
|
|
||||||
static inline int get_sigset_t(sigset_t *set,
|
static inline int get_sigset_t(sigset_t *set,
|
||||||
|
@ -138,11 +133,6 @@ static inline int restore_general_regs(struct pt_regs *regs,
|
||||||
|
|
||||||
#define GP_REGS_SIZE min(sizeof(elf_gregset_t), sizeof(struct pt_regs))
|
#define GP_REGS_SIZE min(sizeof(elf_gregset_t), sizeof(struct pt_regs))
|
||||||
|
|
||||||
static inline int put_sigset_t(sigset_t __user *uset, sigset_t *set)
|
|
||||||
{
|
|
||||||
return copy_to_user(uset, set, sizeof(*uset));
|
|
||||||
}
|
|
||||||
|
|
||||||
#define unsafe_put_sigset_t(uset, set, label) do { \
|
#define unsafe_put_sigset_t(uset, set, label) do { \
|
||||||
sigset_t __user *__us = uset ; \
|
sigset_t __user *__us = uset ; \
|
||||||
const sigset_t *__s = set; \
|
const sigset_t *__s = set; \
|
||||||
|
@ -1048,11 +1038,13 @@ SYSCALL_DEFINE3(swapcontext, struct ucontext __user *, old_ctx,
|
||||||
*/
|
*/
|
||||||
mctx = (struct mcontext __user *)
|
mctx = (struct mcontext __user *)
|
||||||
((unsigned long) &old_ctx->uc_mcontext & ~0xfUL);
|
((unsigned long) &old_ctx->uc_mcontext & ~0xfUL);
|
||||||
if (!access_ok(old_ctx, ctx_size)
|
if (save_user_regs(regs, mctx, NULL, ctx_has_vsx_region))
|
||||||
|| save_user_regs(regs, mctx, NULL, ctx_has_vsx_region)
|
|
||||||
|| put_sigset_t(&old_ctx->uc_sigmask, ¤t->blocked)
|
|
||||||
|| __put_user(to_user_ptr(mctx), &old_ctx->uc_regs))
|
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
if (!user_write_access_begin(old_ctx, ctx_size))
|
||||||
|
return -EFAULT;
|
||||||
|
unsafe_put_sigset_t(&old_ctx->uc_sigmask, ¤t->blocked, failed);
|
||||||
|
unsafe_put_user(to_user_ptr(mctx), &old_ctx->uc_regs, failed);
|
||||||
|
user_write_access_end();
|
||||||
}
|
}
|
||||||
if (new_ctx == NULL)
|
if (new_ctx == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1076,6 +1068,10 @@ SYSCALL_DEFINE3(swapcontext, struct ucontext __user *, old_ctx,
|
||||||
|
|
||||||
set_thread_flag(TIF_RESTOREALL);
|
set_thread_flag(TIF_RESTOREALL);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
failed:
|
||||||
|
user_write_access_end();
|
||||||
|
return -EFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_PPC64
|
#ifdef CONFIG_PPC64
|
||||||
|
|
Загрузка…
Ссылка в новой задаче