Commit 5ca451cf authored by Julien Thierry's avatar Julien Thierry Committed by Russell King

ARM: 8789/1: signal: copy registers using __copy_to_user()

When saving the ARM integer registers, use __copy_to_user() to
copy them into user signal frame, rather than __put_user_error().
This has the benefit of disabling/enabling PAN once for the whole copy
intead of once per write.
Signed-off-by: default avatarJulien Thierry <julien.thierry@arm.com>
Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
parent a3c0f847
...@@ -288,30 +288,35 @@ static int ...@@ -288,30 +288,35 @@ static int
setup_sigframe(struct sigframe __user *sf, struct pt_regs *regs, sigset_t *set) setup_sigframe(struct sigframe __user *sf, struct pt_regs *regs, sigset_t *set)
{ {
struct aux_sigframe __user *aux; struct aux_sigframe __user *aux;
struct sigcontext context;
int err = 0; int err = 0;
__put_user_error(regs->ARM_r0, &sf->uc.uc_mcontext.arm_r0, err); context = (struct sigcontext) {
__put_user_error(regs->ARM_r1, &sf->uc.uc_mcontext.arm_r1, err); .arm_r0 = regs->ARM_r0,
__put_user_error(regs->ARM_r2, &sf->uc.uc_mcontext.arm_r2, err); .arm_r1 = regs->ARM_r1,
__put_user_error(regs->ARM_r3, &sf->uc.uc_mcontext.arm_r3, err); .arm_r2 = regs->ARM_r2,
__put_user_error(regs->ARM_r4, &sf->uc.uc_mcontext.arm_r4, err); .arm_r3 = regs->ARM_r3,
__put_user_error(regs->ARM_r5, &sf->uc.uc_mcontext.arm_r5, err); .arm_r4 = regs->ARM_r4,
__put_user_error(regs->ARM_r6, &sf->uc.uc_mcontext.arm_r6, err); .arm_r5 = regs->ARM_r5,
__put_user_error(regs->ARM_r7, &sf->uc.uc_mcontext.arm_r7, err); .arm_r6 = regs->ARM_r6,
__put_user_error(regs->ARM_r8, &sf->uc.uc_mcontext.arm_r8, err); .arm_r7 = regs->ARM_r7,
__put_user_error(regs->ARM_r9, &sf->uc.uc_mcontext.arm_r9, err); .arm_r8 = regs->ARM_r8,
__put_user_error(regs->ARM_r10, &sf->uc.uc_mcontext.arm_r10, err); .arm_r9 = regs->ARM_r9,
__put_user_error(regs->ARM_fp, &sf->uc.uc_mcontext.arm_fp, err); .arm_r10 = regs->ARM_r10,
__put_user_error(regs->ARM_ip, &sf->uc.uc_mcontext.arm_ip, err); .arm_fp = regs->ARM_fp,
__put_user_error(regs->ARM_sp, &sf->uc.uc_mcontext.arm_sp, err); .arm_ip = regs->ARM_ip,
__put_user_error(regs->ARM_lr, &sf->uc.uc_mcontext.arm_lr, err); .arm_sp = regs->ARM_sp,
__put_user_error(regs->ARM_pc, &sf->uc.uc_mcontext.arm_pc, err); .arm_lr = regs->ARM_lr,
__put_user_error(regs->ARM_cpsr, &sf->uc.uc_mcontext.arm_cpsr, err); .arm_pc = regs->ARM_pc,
.arm_cpsr = regs->ARM_cpsr,
__put_user_error(current->thread.trap_no, &sf->uc.uc_mcontext.trap_no, err);
__put_user_error(current->thread.error_code, &sf->uc.uc_mcontext.error_code, err); .trap_no = current->thread.trap_no,
__put_user_error(current->thread.address, &sf->uc.uc_mcontext.fault_address, err); .error_code = current->thread.error_code,
__put_user_error(set->sig[0], &sf->uc.uc_mcontext.oldmask, err); .fault_address = current->thread.address,
.oldmask = set->sig[0],
};
err |= __copy_to_user(&sf->uc.uc_mcontext, &context, sizeof(context));
err |= __copy_to_user(&sf->uc.uc_sigmask, set, sizeof(*set)); err |= __copy_to_user(&sf->uc.uc_sigmask, set, sizeof(*set));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment