[S390] Cleanup in signal handling code.
Signed-off-by: Gerald Schaefer <geraldsc@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
This commit is contained in:
committed by
Martin Schwidefsky
parent
9282ed9297
commit
6837a8c352
@@ -114,29 +114,26 @@ sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss,
|
|||||||
static int save_sigregs(struct pt_regs *regs, _sigregs __user *sregs)
|
static int save_sigregs(struct pt_regs *regs, _sigregs __user *sregs)
|
||||||
{
|
{
|
||||||
unsigned long old_mask = regs->psw.mask;
|
unsigned long old_mask = regs->psw.mask;
|
||||||
int err;
|
_sigregs user_sregs;
|
||||||
|
|
||||||
save_access_regs(current->thread.acrs);
|
save_access_regs(current->thread.acrs);
|
||||||
|
|
||||||
/* Copy a 'clean' PSW mask to the user to avoid leaking
|
/* Copy a 'clean' PSW mask to the user to avoid leaking
|
||||||
information about whether PER is currently on. */
|
information about whether PER is currently on. */
|
||||||
regs->psw.mask = PSW_MASK_MERGE(PSW_USER_BITS, regs->psw.mask);
|
regs->psw.mask = PSW_MASK_MERGE(PSW_USER_BITS, regs->psw.mask);
|
||||||
err = __copy_to_user(&sregs->regs.psw, ®s->psw,
|
memcpy(&user_sregs.regs.psw, ®s->psw, sizeof(sregs->regs.psw) +
|
||||||
sizeof(sregs->regs.psw)+sizeof(sregs->regs.gprs));
|
sizeof(sregs->regs.gprs));
|
||||||
regs->psw.mask = old_mask;
|
regs->psw.mask = old_mask;
|
||||||
if (err != 0)
|
memcpy(&user_sregs.regs.acrs, current->thread.acrs,
|
||||||
return err;
|
sizeof(sregs->regs.acrs));
|
||||||
err = __copy_to_user(&sregs->regs.acrs, current->thread.acrs,
|
|
||||||
sizeof(sregs->regs.acrs));
|
|
||||||
if (err != 0)
|
|
||||||
return err;
|
|
||||||
/*
|
/*
|
||||||
* We have to store the fp registers to current->thread.fp_regs
|
* We have to store the fp registers to current->thread.fp_regs
|
||||||
* to merge them with the emulated registers.
|
* to merge them with the emulated registers.
|
||||||
*/
|
*/
|
||||||
save_fp_regs(¤t->thread.fp_regs);
|
save_fp_regs(¤t->thread.fp_regs);
|
||||||
return __copy_to_user(&sregs->fpregs, ¤t->thread.fp_regs,
|
memcpy(&user_sregs.fpregs, ¤t->thread.fp_regs,
|
||||||
sizeof(s390_fp_regs));
|
sizeof(s390_fp_regs));
|
||||||
|
return __copy_to_user(sregs, &user_sregs, sizeof(_sigregs));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Returns positive number on error */
|
/* Returns positive number on error */
|
||||||
@@ -144,27 +141,25 @@ static int restore_sigregs(struct pt_regs *regs, _sigregs __user *sregs)
|
|||||||
{
|
{
|
||||||
unsigned long old_mask = regs->psw.mask;
|
unsigned long old_mask = regs->psw.mask;
|
||||||
int err;
|
int err;
|
||||||
|
_sigregs user_sregs;
|
||||||
|
|
||||||
/* Alwys make any pending restarted system call return -EINTR */
|
/* Alwys make any pending restarted system call return -EINTR */
|
||||||
current_thread_info()->restart_block.fn = do_no_restart_syscall;
|
current_thread_info()->restart_block.fn = do_no_restart_syscall;
|
||||||
|
|
||||||
err = __copy_from_user(®s->psw, &sregs->regs.psw,
|
err = __copy_from_user(&user_sregs, sregs, sizeof(_sigregs));
|
||||||
sizeof(sregs->regs.psw)+sizeof(sregs->regs.gprs));
|
|
||||||
regs->psw.mask = PSW_MASK_MERGE(old_mask, regs->psw.mask);
|
regs->psw.mask = PSW_MASK_MERGE(old_mask, regs->psw.mask);
|
||||||
regs->psw.addr |= PSW_ADDR_AMODE;
|
regs->psw.addr |= PSW_ADDR_AMODE;
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
err = __copy_from_user(¤t->thread.acrs, &sregs->regs.acrs,
|
memcpy(®s->psw, &user_sregs.regs.psw, sizeof(sregs->regs.psw) +
|
||||||
sizeof(sregs->regs.acrs));
|
sizeof(sregs->regs.gprs));
|
||||||
if (err)
|
memcpy(¤t->thread.acrs, &user_sregs.regs.acrs,
|
||||||
return err;
|
sizeof(sregs->regs.acrs));
|
||||||
restore_access_regs(current->thread.acrs);
|
restore_access_regs(current->thread.acrs);
|
||||||
|
|
||||||
err = __copy_from_user(¤t->thread.fp_regs, &sregs->fpregs,
|
memcpy(¤t->thread.fp_regs, &user_sregs.fpregs,
|
||||||
sizeof(s390_fp_regs));
|
sizeof(s390_fp_regs));
|
||||||
current->thread.fp_regs.fpc &= FPC_VALID_MASK;
|
current->thread.fp_regs.fpc &= FPC_VALID_MASK;
|
||||||
if (err)
|
|
||||||
return err;
|
|
||||||
|
|
||||||
restore_fp_regs(¤t->thread.fp_regs);
|
restore_fp_regs(¤t->thread.fp_regs);
|
||||||
regs->trap = -1; /* disable syscall checks */
|
regs->trap = -1; /* disable syscall checks */
|
||||||
|
Reference in New Issue
Block a user