]> git.hungrycats.org Git - linux/commitdiff
sparc/ptrace: Preserve previous registers for short regset write
authorDave Martin <Dave.Martin@arm.com>
Mon, 27 Mar 2017 14:10:59 +0000 (15:10 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 20 Jun 2017 12:04:37 +0000 (14:04 +0200)
commit d3805c546b275c8cc7d40f759d029ae92c7175f2 upstream.

Ensure that if userspace supplies insufficient data to PTRACE_SETREGSET
to fill all the registers, the thread's old registers are preserved.

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
arch/sparc/kernel/ptrace_64.c

index 7ff45e4ba6815080a29e02a64ad79bfdf9c1ed12..875ddf00dab4cacf485399e3fdb9157c855a2e19 100644 (file)
@@ -308,7 +308,7 @@ static int genregs64_set(struct task_struct *target,
        }
 
        if (!ret) {
-               unsigned long y;
+               unsigned long y = regs->y;
 
                ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
                                         &y,