aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86_64/kernel/ptrace.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86_64/kernel/ptrace.c')
-rw-r--r--arch/x86_64/kernel/ptrace.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/arch/x86_64/kernel/ptrace.c b/arch/x86_64/kernel/ptrace.c
index 525f6a128a27..bbf64b59a21e 100644
--- a/arch/x86_64/kernel/ptrace.c
+++ b/arch/x86_64/kernel/ptrace.c
@@ -257,12 +257,12 @@ static int putreg(struct task_struct *child,
257 value &= 0xffff; 257 value &= 0xffff;
258 return 0; 258 return 0;
259 case offsetof(struct user_regs_struct,fs_base): 259 case offsetof(struct user_regs_struct,fs_base):
260 if (value >= TASK_SIZE) 260 if (value >= TASK_SIZE_OF(child))
261 return -EIO; 261 return -EIO;
262 child->thread.fs = value; 262 child->thread.fs = value;
263 return 0; 263 return 0;
264 case offsetof(struct user_regs_struct,gs_base): 264 case offsetof(struct user_regs_struct,gs_base):
265 if (value >= TASK_SIZE) 265 if (value >= TASK_SIZE_OF(child))
266 return -EIO; 266 return -EIO;
267 child->thread.gs = value; 267 child->thread.gs = value;
268 return 0; 268 return 0;
@@ -279,7 +279,7 @@ static int putreg(struct task_struct *child,
279 break; 279 break;
280 case offsetof(struct user_regs_struct, rip): 280 case offsetof(struct user_regs_struct, rip):
281 /* Check if the new RIP address is canonical */ 281 /* Check if the new RIP address is canonical */
282 if (value >= TASK_SIZE) 282 if (value >= TASK_SIZE_OF(child))
283 return -EIO; 283 return -EIO;
284 break; 284 break;
285 } 285 }
@@ -419,6 +419,8 @@ asmlinkage long sys_ptrace(long request, long pid, unsigned long addr, long data
419 break; 419 break;
420 420
421 case PTRACE_POKEUSR: /* write the word at location addr in the USER area */ 421 case PTRACE_POKEUSR: /* write the word at location addr in the USER area */
422 {
423 int dsize = test_tsk_thread_flag(child, TIF_IA32) ? 3 : 7;
422 ret = -EIO; 424 ret = -EIO;
423 if ((addr & 7) || 425 if ((addr & 7) ||
424 addr > sizeof(struct user) - 7) 426 addr > sizeof(struct user) - 7)
@@ -430,22 +432,22 @@ asmlinkage long sys_ptrace(long request, long pid, unsigned long addr, long data
430 break; 432 break;
431 /* Disallows to set a breakpoint into the vsyscall */ 433 /* Disallows to set a breakpoint into the vsyscall */
432 case offsetof(struct user, u_debugreg[0]): 434 case offsetof(struct user, u_debugreg[0]):
433 if (data >= TASK_SIZE-7) break; 435 if (data >= TASK_SIZE_OF(child) - dsize) break;
434 child->thread.debugreg0 = data; 436 child->thread.debugreg0 = data;
435 ret = 0; 437 ret = 0;
436 break; 438 break;
437 case offsetof(struct user, u_debugreg[1]): 439 case offsetof(struct user, u_debugreg[1]):
438 if (data >= TASK_SIZE-7) break; 440 if (data >= TASK_SIZE_OF(child) - dsize) break;
439 child->thread.debugreg1 = data; 441 child->thread.debugreg1 = data;
440 ret = 0; 442 ret = 0;
441 break; 443 break;
442 case offsetof(struct user, u_debugreg[2]): 444 case offsetof(struct user, u_debugreg[2]):
443 if (data >= TASK_SIZE-7) break; 445 if (data >= TASK_SIZE_OF(child) - dsize) break;
444 child->thread.debugreg2 = data; 446 child->thread.debugreg2 = data;
445 ret = 0; 447 ret = 0;
446 break; 448 break;
447 case offsetof(struct user, u_debugreg[3]): 449 case offsetof(struct user, u_debugreg[3]):
448 if (data >= TASK_SIZE-7) break; 450 if (data >= TASK_SIZE_OF(child) - dsize) break;
449 child->thread.debugreg3 = data; 451 child->thread.debugreg3 = data;
450 ret = 0; 452 ret = 0;
451 break; 453 break;
@@ -469,6 +471,7 @@ asmlinkage long sys_ptrace(long request, long pid, unsigned long addr, long data
469 break; 471 break;
470 } 472 }
471 break; 473 break;
474 }
472 case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */ 475 case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */
473 case PTRACE_CONT: /* restart after signal. */ 476 case PTRACE_CONT: /* restart after signal. */
474 477