mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-02 23:27:06 +00:00
x86/signal: Change return type of restore_sigcontext() to boolean
None of the call sites cares about the return code. All they are interested in is success or fail. Suggested-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Borislav Petkov <bp@suse.de> Link: https://lkml.kernel.org/r/20210908132525.851280949@linutronix.de
This commit is contained in:
parent
2af07f3a6e
commit
ee4ecdfbd2
2 changed files with 15 additions and 15 deletions
|
@ -57,8 +57,8 @@ static inline void reload_segments(struct sigcontext_32 *sc)
|
||||||
/*
|
/*
|
||||||
* Do a signal return; undo the signal stack.
|
* Do a signal return; undo the signal stack.
|
||||||
*/
|
*/
|
||||||
static int ia32_restore_sigcontext(struct pt_regs *regs,
|
static bool ia32_restore_sigcontext(struct pt_regs *regs,
|
||||||
struct sigcontext_32 __user *usc)
|
struct sigcontext_32 __user *usc)
|
||||||
{
|
{
|
||||||
struct sigcontext_32 sc;
|
struct sigcontext_32 sc;
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ static int ia32_restore_sigcontext(struct pt_regs *regs,
|
||||||
current->restart_block.fn = do_no_restart_syscall;
|
current->restart_block.fn = do_no_restart_syscall;
|
||||||
|
|
||||||
if (unlikely(copy_from_user(&sc, usc, sizeof(sc))))
|
if (unlikely(copy_from_user(&sc, usc, sizeof(sc))))
|
||||||
return -EFAULT;
|
return false;
|
||||||
|
|
||||||
/* Get only the ia32 registers. */
|
/* Get only the ia32 registers. */
|
||||||
regs->bx = sc.bx;
|
regs->bx = sc.bx;
|
||||||
|
@ -94,7 +94,7 @@ static int ia32_restore_sigcontext(struct pt_regs *regs,
|
||||||
* normal case.
|
* normal case.
|
||||||
*/
|
*/
|
||||||
reload_segments(&sc);
|
reload_segments(&sc);
|
||||||
return fpu__restore_sig(compat_ptr(sc.fpstate), 1);
|
return !fpu__restore_sig(compat_ptr(sc.fpstate), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
COMPAT_SYSCALL_DEFINE0(sigreturn)
|
COMPAT_SYSCALL_DEFINE0(sigreturn)
|
||||||
|
@ -111,7 +111,7 @@ COMPAT_SYSCALL_DEFINE0(sigreturn)
|
||||||
|
|
||||||
set_current_blocked(&set);
|
set_current_blocked(&set);
|
||||||
|
|
||||||
if (ia32_restore_sigcontext(regs, &frame->sc))
|
if (!ia32_restore_sigcontext(regs, &frame->sc))
|
||||||
goto badframe;
|
goto badframe;
|
||||||
return regs->ax;
|
return regs->ax;
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ COMPAT_SYSCALL_DEFINE0(rt_sigreturn)
|
||||||
|
|
||||||
set_current_blocked(&set);
|
set_current_blocked(&set);
|
||||||
|
|
||||||
if (ia32_restore_sigcontext(regs, &frame->uc.uc_mcontext))
|
if (!ia32_restore_sigcontext(regs, &frame->uc.uc_mcontext))
|
||||||
goto badframe;
|
goto badframe;
|
||||||
|
|
||||||
if (compat_restore_altstack(&frame->uc.uc_stack))
|
if (compat_restore_altstack(&frame->uc.uc_stack))
|
||||||
|
|
|
@ -79,9 +79,9 @@ static void force_valid_ss(struct pt_regs *regs)
|
||||||
# define CONTEXT_COPY_SIZE sizeof(struct sigcontext)
|
# define CONTEXT_COPY_SIZE sizeof(struct sigcontext)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int restore_sigcontext(struct pt_regs *regs,
|
static bool restore_sigcontext(struct pt_regs *regs,
|
||||||
struct sigcontext __user *usc,
|
struct sigcontext __user *usc,
|
||||||
unsigned long uc_flags)
|
unsigned long uc_flags)
|
||||||
{
|
{
|
||||||
struct sigcontext sc;
|
struct sigcontext sc;
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ static int restore_sigcontext(struct pt_regs *regs,
|
||||||
current->restart_block.fn = do_no_restart_syscall;
|
current->restart_block.fn = do_no_restart_syscall;
|
||||||
|
|
||||||
if (copy_from_user(&sc, usc, CONTEXT_COPY_SIZE))
|
if (copy_from_user(&sc, usc, CONTEXT_COPY_SIZE))
|
||||||
return -EFAULT;
|
return false;
|
||||||
|
|
||||||
#ifdef CONFIG_X86_32
|
#ifdef CONFIG_X86_32
|
||||||
set_user_gs(regs, sc.gs);
|
set_user_gs(regs, sc.gs);
|
||||||
|
@ -136,8 +136,8 @@ static int restore_sigcontext(struct pt_regs *regs,
|
||||||
force_valid_ss(regs);
|
force_valid_ss(regs);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return fpu__restore_sig((void __user *)sc.fpstate,
|
return !fpu__restore_sig((void __user *)sc.fpstate,
|
||||||
IS_ENABLED(CONFIG_X86_32));
|
IS_ENABLED(CONFIG_X86_32));
|
||||||
}
|
}
|
||||||
|
|
||||||
static __always_inline int
|
static __always_inline int
|
||||||
|
@ -641,7 +641,7 @@ SYSCALL_DEFINE0(sigreturn)
|
||||||
* x86_32 has no uc_flags bits relevant to restore_sigcontext.
|
* x86_32 has no uc_flags bits relevant to restore_sigcontext.
|
||||||
* Save a few cycles by skipping the __get_user.
|
* Save a few cycles by skipping the __get_user.
|
||||||
*/
|
*/
|
||||||
if (restore_sigcontext(regs, &frame->sc, 0))
|
if (!restore_sigcontext(regs, &frame->sc, 0))
|
||||||
goto badframe;
|
goto badframe;
|
||||||
return regs->ax;
|
return regs->ax;
|
||||||
|
|
||||||
|
@ -669,7 +669,7 @@ SYSCALL_DEFINE0(rt_sigreturn)
|
||||||
|
|
||||||
set_current_blocked(&set);
|
set_current_blocked(&set);
|
||||||
|
|
||||||
if (restore_sigcontext(regs, &frame->uc.uc_mcontext, uc_flags))
|
if (!restore_sigcontext(regs, &frame->uc.uc_mcontext, uc_flags))
|
||||||
goto badframe;
|
goto badframe;
|
||||||
|
|
||||||
if (restore_altstack(&frame->uc.uc_stack))
|
if (restore_altstack(&frame->uc.uc_stack))
|
||||||
|
@ -927,7 +927,7 @@ COMPAT_SYSCALL_DEFINE0(x32_rt_sigreturn)
|
||||||
|
|
||||||
set_current_blocked(&set);
|
set_current_blocked(&set);
|
||||||
|
|
||||||
if (restore_sigcontext(regs, &frame->uc.uc_mcontext, uc_flags))
|
if (!restore_sigcontext(regs, &frame->uc.uc_mcontext, uc_flags))
|
||||||
goto badframe;
|
goto badframe;
|
||||||
|
|
||||||
if (compat_restore_altstack(&frame->uc.uc_stack))
|
if (compat_restore_altstack(&frame->uc.uc_stack))
|
||||||
|
|
Loading…
Reference in a new issue