Commit 08ff18e2 authored by Roland McGrath's avatar Roland McGrath

x86: ptrace: do not sign-extend orig_ax on write

The high 32 bits of orig_ax will be ignored when it matters,
so don't fiddle them when setting it.
Signed-off-by: default avatarRoland McGrath <roland@redhat.com>
parent 18c1e2c8
...@@ -325,16 +325,6 @@ static int putreg(struct task_struct *child, ...@@ -325,16 +325,6 @@ static int putreg(struct task_struct *child,
return set_flags(child, value); return set_flags(child, value);
#ifdef CONFIG_X86_64 #ifdef CONFIG_X86_64
/*
* Orig_ax is really just a flag with small positive and
* negative values, so make sure to always sign-extend it
* from 32 bits so that it works correctly regardless of
* whether we come from a 32-bit environment or not.
*/
case offsetof(struct user_regs_struct, orig_ax):
value = (long) (s32) value;
break;
case offsetof(struct user_regs_struct,fs_base): case offsetof(struct user_regs_struct,fs_base):
if (value >= TASK_SIZE_OF(child)) if (value >= TASK_SIZE_OF(child))
return -EIO; return -EIO;
...@@ -1121,17 +1111,10 @@ static int putreg32(struct task_struct *child, unsigned regno, u32 value) ...@@ -1121,17 +1111,10 @@ static int putreg32(struct task_struct *child, unsigned regno, u32 value)
R32(esi, si); R32(esi, si);
R32(ebp, bp); R32(ebp, bp);
R32(eax, ax); R32(eax, ax);
R32(orig_eax, orig_ax);
R32(eip, ip); R32(eip, ip);
R32(esp, sp); R32(esp, sp);
case offsetof(struct user32, regs.orig_eax):
/*
* Sign-extend the value so that orig_eax = -1
* causes (long)orig_ax < 0 tests to fire correctly.
*/
regs->orig_ax = (long) (s32) value;
break;
case offsetof(struct user32, regs.eflags): case offsetof(struct user32, regs.eflags):
return set_flags(child, value); return set_flags(child, value);
......
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