Skip to content

Commit

Permalink
[PATCH] x86-64: Check return value of putreg in PTRACE_SETREGS
Browse files Browse the repository at this point in the history
This means if an illegal value is set for the segment registers there
ptrace will error out now with an errno instead of silently ignoring
it.

Signed-off-by: Andi Kleen <ak@suse.de>
  • Loading branch information
Andi Kleen authored and Andi Kleen committed Feb 13, 2007
1 parent 2f7a2a7 commit f49481b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions arch/x86_64/kernel/ptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -536,8 +536,12 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
}
ret = 0;
for (ui = 0; ui < sizeof(struct user_regs_struct); ui += sizeof(long)) {
ret |= __get_user(tmp, (unsigned long __user *) data);
putreg(child, ui, tmp);
ret = __get_user(tmp, (unsigned long __user *) data);
if (ret)
break;
ret = putreg(child, ui, tmp);
if (ret)
break;
data += sizeof(long);
}
break;
Expand Down

0 comments on commit f49481b

Please sign in to comment.