Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 34186
b: refs/heads/master
c: 6837a8c
h: refs/heads/master
v: v3
  • Loading branch information
Gerald Schaefer authored and Martin Schwidefsky committed Sep 20, 2006
1 parent 191700f commit 27c065a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 23 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9282ed929758b82f448a40d3c17319d794970624
refs/heads/master: 6837a8c352efcc5efc70424e9bfd94ff9bfa9a47
39 changes: 17 additions & 22 deletions trunk/arch/s390/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,57 +114,52 @@ sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss,
static int save_sigregs(struct pt_regs *regs, _sigregs __user *sregs)
{
unsigned long old_mask = regs->psw.mask;
int err;
_sigregs user_sregs;

save_access_regs(current->thread.acrs);

/* Copy a 'clean' PSW mask to the user to avoid leaking
information about whether PER is currently on. */
regs->psw.mask = PSW_MASK_MERGE(PSW_USER_BITS, regs->psw.mask);
err = __copy_to_user(&sregs->regs.psw, &regs->psw,
sizeof(sregs->regs.psw)+sizeof(sregs->regs.gprs));
memcpy(&user_sregs.regs.psw, &regs->psw, sizeof(sregs->regs.psw) +
sizeof(sregs->regs.gprs));
regs->psw.mask = old_mask;
if (err != 0)
return err;
err = __copy_to_user(&sregs->regs.acrs, current->thread.acrs,
sizeof(sregs->regs.acrs));
if (err != 0)
return err;
memcpy(&user_sregs.regs.acrs, current->thread.acrs,
sizeof(sregs->regs.acrs));
/*
* We have to store the fp registers to current->thread.fp_regs
* to merge them with the emulated registers.
*/
save_fp_regs(&current->thread.fp_regs);
return __copy_to_user(&sregs->fpregs, &current->thread.fp_regs,
sizeof(s390_fp_regs));
memcpy(&user_sregs.fpregs, &current->thread.fp_regs,
sizeof(s390_fp_regs));
return __copy_to_user(sregs, &user_sregs, sizeof(_sigregs));
}

/* Returns positive number on error */
static int restore_sigregs(struct pt_regs *regs, _sigregs __user *sregs)
{
unsigned long old_mask = regs->psw.mask;
int err;
_sigregs user_sregs;

/* Alwys make any pending restarted system call return -EINTR */
current_thread_info()->restart_block.fn = do_no_restart_syscall;

err = __copy_from_user(&regs->psw, &sregs->regs.psw,
sizeof(sregs->regs.psw)+sizeof(sregs->regs.gprs));
err = __copy_from_user(&user_sregs, sregs, sizeof(_sigregs));
regs->psw.mask = PSW_MASK_MERGE(old_mask, regs->psw.mask);
regs->psw.addr |= PSW_ADDR_AMODE;
if (err)
return err;
err = __copy_from_user(&current->thread.acrs, &sregs->regs.acrs,
sizeof(sregs->regs.acrs));
if (err)
return err;
memcpy(&regs->psw, &user_sregs.regs.psw, sizeof(sregs->regs.psw) +
sizeof(sregs->regs.gprs));
memcpy(&current->thread.acrs, &user_sregs.regs.acrs,
sizeof(sregs->regs.acrs));
restore_access_regs(current->thread.acrs);

err = __copy_from_user(&current->thread.fp_regs, &sregs->fpregs,
sizeof(s390_fp_regs));
memcpy(&current->thread.fp_regs, &user_sregs.fpregs,
sizeof(s390_fp_regs));
current->thread.fp_regs.fpc &= FPC_VALID_MASK;
if (err)
return err;

restore_fp_regs(&current->thread.fp_regs);
regs->trap = -1; /* disable syscall checks */
Expand Down

0 comments on commit 27c065a

Please sign in to comment.