aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/ptrace.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@redhat.com>2009-09-22 22:58:58 -0400
committerRoland McGrath <roland@redhat.com>2009-09-23 01:46:48 -0400
commit08ff18e299b1a1c91f4911fe9f35c4550218c73f (patch)
tree9f4c180bf7dfc358727fffdcc1cbe9f805b526bd /arch/x86/kernel/ptrace.c
parent18c1e2c80d92adca50ffc654617639a4aa35f29c (diff)
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: Roland McGrath <roland@redhat.com>
Diffstat (limited to 'arch/x86/kernel/ptrace.c')
-rw-r--r--arch/x86/kernel/ptrace.c19
1 files changed, 1 insertions, 18 deletions
diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c
index 8d7d5c9c1be3..52222fab99f4 100644
--- a/arch/x86/kernel/ptrace.c
+++ b/arch/x86/kernel/ptrace.c
@@ -325,16 +325,6 @@ static int putreg(struct task_struct *child,
325 return set_flags(child, value); 325 return set_flags(child, value);
326 326
327#ifdef CONFIG_X86_64 327#ifdef CONFIG_X86_64
328 /*
329 * Orig_ax is really just a flag with small positive and
330 * negative values, so make sure to always sign-extend it
331 * from 32 bits so that it works correctly regardless of
332 * whether we come from a 32-bit environment or not.
333 */
334 case offsetof(struct user_regs_struct, orig_ax):
335 value = (long) (s32) value;
336 break;
337
338 case offsetof(struct user_regs_struct,fs_base): 328 case offsetof(struct user_regs_struct,fs_base):
339 if (value >= TASK_SIZE_OF(child)) 329 if (value >= TASK_SIZE_OF(child))
340 return -EIO; 330 return -EIO;
@@ -1121,17 +1111,10 @@ static int putreg32(struct task_struct *child, unsigned regno, u32 value)
1121 R32(esi, si); 1111 R32(esi, si);
1122 R32(ebp, bp); 1112 R32(ebp, bp);
1123 R32(eax, ax); 1113 R32(eax, ax);
1114 R32(orig_eax, orig_ax);
1124 R32(eip, ip); 1115 R32(eip, ip);
1125 R32(esp, sp); 1116 R32(esp, sp);
1126 1117
1127 case offsetof(struct user32, regs.orig_eax):
1128 /*
1129 * Sign-extend the value so that orig_eax = -1
1130 * causes (long)orig_ax < 0 tests to fire correctly.
1131 */
1132 regs->orig_ax = (long) (s32) value;
1133 break;
1134
1135 case offsetof(struct user32, regs.eflags): 1118 case offsetof(struct user32, regs.eflags):
1136 return set_flags(child, value); 1119 return set_flags(child, value);
1137 1120