mirror of
https://github.com/torvalds/linux.git
synced 2024-11-28 23:21:31 +00:00
arc: don't leak bits of kernel stack into coredump
On faulting sigreturn we do get SIGSEGV, all right, but anything we'd put into pt_regs could end up in the coredump. And since __copy_from_user() never zeroed on arc, we'd better bugger off on its failure without copying random uninitialized bits of kernel stack into pt_regs... Cc: stable@vger.kernel.org Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
085354f907
commit
7798bf2140
@ -107,13 +107,13 @@ static int restore_usr_regs(struct pt_regs *regs, struct rt_sigframe __user *sf)
|
|||||||
struct user_regs_struct uregs;
|
struct user_regs_struct uregs;
|
||||||
|
|
||||||
err = __copy_from_user(&set, &sf->uc.uc_sigmask, sizeof(set));
|
err = __copy_from_user(&set, &sf->uc.uc_sigmask, sizeof(set));
|
||||||
if (!err)
|
|
||||||
set_current_blocked(&set);
|
|
||||||
|
|
||||||
err |= __copy_from_user(&uregs.scratch,
|
err |= __copy_from_user(&uregs.scratch,
|
||||||
&(sf->uc.uc_mcontext.regs.scratch),
|
&(sf->uc.uc_mcontext.regs.scratch),
|
||||||
sizeof(sf->uc.uc_mcontext.regs.scratch));
|
sizeof(sf->uc.uc_mcontext.regs.scratch));
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
|
||||||
|
set_current_blocked(&set);
|
||||||
regs->bta = uregs.scratch.bta;
|
regs->bta = uregs.scratch.bta;
|
||||||
regs->lp_start = uregs.scratch.lp_start;
|
regs->lp_start = uregs.scratch.lp_start;
|
||||||
regs->lp_end = uregs.scratch.lp_end;
|
regs->lp_end = uregs.scratch.lp_end;
|
||||||
@ -138,7 +138,7 @@ static int restore_usr_regs(struct pt_regs *regs, struct rt_sigframe __user *sf)
|
|||||||
regs->r0 = uregs.scratch.r0;
|
regs->r0 = uregs.scratch.r0;
|
||||||
regs->sp = uregs.scratch.sp;
|
regs->sp = uregs.scratch.sp;
|
||||||
|
|
||||||
return err;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int is_do_ss_needed(unsigned int magic)
|
static inline int is_do_ss_needed(unsigned int magic)
|
||||||
|
Loading…
Reference in New Issue
Block a user