diff options
Diffstat (limited to 'arch/s390/kernel/ptrace.c')
-rw-r--r-- | arch/s390/kernel/ptrace.c | 46 |
1 files changed, 24 insertions, 22 deletions
diff --git a/arch/s390/kernel/ptrace.c b/arch/s390/kernel/ptrace.c index 8f36504075ed..2a8f0872ea8b 100644 --- a/arch/s390/kernel/ptrace.c +++ b/arch/s390/kernel/ptrace.c | |||
@@ -86,15 +86,13 @@ FixPerRegisters(struct task_struct *task) | |||
86 | per_info->control_regs.bits.storage_alt_space_ctl = 0; | 86 | per_info->control_regs.bits.storage_alt_space_ctl = 0; |
87 | } | 87 | } |
88 | 88 | ||
89 | void | 89 | static void set_single_step(struct task_struct *task) |
90 | set_single_step(struct task_struct *task) | ||
91 | { | 90 | { |
92 | task->thread.per_info.single_step = 1; | 91 | task->thread.per_info.single_step = 1; |
93 | FixPerRegisters(task); | 92 | FixPerRegisters(task); |
94 | } | 93 | } |
95 | 94 | ||
96 | void | 95 | static void clear_single_step(struct task_struct *task) |
97 | clear_single_step(struct task_struct *task) | ||
98 | { | 96 | { |
99 | task->thread.per_info.single_step = 0; | 97 | task->thread.per_info.single_step = 0; |
100 | FixPerRegisters(task); | 98 | FixPerRegisters(task); |
@@ -232,9 +230,9 @@ poke_user(struct task_struct *child, addr_t addr, addr_t data) | |||
232 | */ | 230 | */ |
233 | if (addr == (addr_t) &dummy->regs.psw.mask && | 231 | if (addr == (addr_t) &dummy->regs.psw.mask && |
234 | #ifdef CONFIG_COMPAT | 232 | #ifdef CONFIG_COMPAT |
235 | data != PSW_MASK_MERGE(PSW_USER32_BITS, data) && | 233 | data != PSW_MASK_MERGE(psw_user32_bits, data) && |
236 | #endif | 234 | #endif |
237 | data != PSW_MASK_MERGE(PSW_USER_BITS, data)) | 235 | data != PSW_MASK_MERGE(psw_user_bits, data)) |
238 | /* Invalid psw mask. */ | 236 | /* Invalid psw mask. */ |
239 | return -EINVAL; | 237 | return -EINVAL; |
240 | #ifndef CONFIG_64BIT | 238 | #ifndef CONFIG_64BIT |
@@ -309,7 +307,7 @@ do_ptrace_normal(struct task_struct *child, long request, long addr, long data) | |||
309 | copied = access_process_vm(child, addr, &tmp, sizeof(tmp), 0); | 307 | copied = access_process_vm(child, addr, &tmp, sizeof(tmp), 0); |
310 | if (copied != sizeof(tmp)) | 308 | if (copied != sizeof(tmp)) |
311 | return -EIO; | 309 | return -EIO; |
312 | return put_user(tmp, (unsigned long __user *) data); | 310 | return put_user(tmp, (unsigned long __force __user *) data); |
313 | 311 | ||
314 | case PTRACE_PEEKUSR: | 312 | case PTRACE_PEEKUSR: |
315 | /* read the word at location addr in the USER area. */ | 313 | /* read the word at location addr in the USER area. */ |
@@ -331,7 +329,7 @@ do_ptrace_normal(struct task_struct *child, long request, long addr, long data) | |||
331 | 329 | ||
332 | case PTRACE_PEEKUSR_AREA: | 330 | case PTRACE_PEEKUSR_AREA: |
333 | case PTRACE_POKEUSR_AREA: | 331 | case PTRACE_POKEUSR_AREA: |
334 | if (copy_from_user(&parea, (void __user *) addr, | 332 | if (copy_from_user(&parea, (void __force __user *) addr, |
335 | sizeof(parea))) | 333 | sizeof(parea))) |
336 | return -EFAULT; | 334 | return -EFAULT; |
337 | addr = parea.kernel_addr; | 335 | addr = parea.kernel_addr; |
@@ -341,10 +339,11 @@ do_ptrace_normal(struct task_struct *child, long request, long addr, long data) | |||
341 | if (request == PTRACE_PEEKUSR_AREA) | 339 | if (request == PTRACE_PEEKUSR_AREA) |
342 | ret = peek_user(child, addr, data); | 340 | ret = peek_user(child, addr, data); |
343 | else { | 341 | else { |
344 | addr_t tmp; | 342 | addr_t utmp; |
345 | if (get_user (tmp, (addr_t __user *) data)) | 343 | if (get_user(utmp, |
344 | (addr_t __force __user *) data)) | ||
346 | return -EFAULT; | 345 | return -EFAULT; |
347 | ret = poke_user(child, addr, tmp); | 346 | ret = poke_user(child, addr, utmp); |
348 | } | 347 | } |
349 | if (ret) | 348 | if (ret) |
350 | return ret; | 349 | return ret; |
@@ -394,7 +393,7 @@ peek_user_emu31(struct task_struct *child, addr_t addr, addr_t data) | |||
394 | if (addr == (addr_t) &dummy32->regs.psw.mask) { | 393 | if (addr == (addr_t) &dummy32->regs.psw.mask) { |
395 | /* Fake a 31 bit psw mask. */ | 394 | /* Fake a 31 bit psw mask. */ |
396 | tmp = (__u32)(task_pt_regs(child)->psw.mask >> 32); | 395 | tmp = (__u32)(task_pt_regs(child)->psw.mask >> 32); |
397 | tmp = PSW32_MASK_MERGE(PSW32_USER_BITS, tmp); | 396 | tmp = PSW32_MASK_MERGE(psw32_user_bits, tmp); |
398 | } else if (addr == (addr_t) &dummy32->regs.psw.addr) { | 397 | } else if (addr == (addr_t) &dummy32->regs.psw.addr) { |
399 | /* Fake a 31 bit psw address. */ | 398 | /* Fake a 31 bit psw address. */ |
400 | tmp = (__u32) task_pt_regs(child)->psw.addr | | 399 | tmp = (__u32) task_pt_regs(child)->psw.addr | |
@@ -469,11 +468,11 @@ poke_user_emu31(struct task_struct *child, addr_t addr, addr_t data) | |||
469 | */ | 468 | */ |
470 | if (addr == (addr_t) &dummy32->regs.psw.mask) { | 469 | if (addr == (addr_t) &dummy32->regs.psw.mask) { |
471 | /* Build a 64 bit psw mask from 31 bit mask. */ | 470 | /* Build a 64 bit psw mask from 31 bit mask. */ |
472 | if (tmp != PSW32_MASK_MERGE(PSW32_USER_BITS, tmp)) | 471 | if (tmp != PSW32_MASK_MERGE(psw32_user_bits, tmp)) |
473 | /* Invalid psw mask. */ | 472 | /* Invalid psw mask. */ |
474 | return -EINVAL; | 473 | return -EINVAL; |
475 | task_pt_regs(child)->psw.mask = | 474 | task_pt_regs(child)->psw.mask = |
476 | PSW_MASK_MERGE(PSW_USER32_BITS, (__u64) tmp << 32); | 475 | PSW_MASK_MERGE(psw_user32_bits, (__u64) tmp << 32); |
477 | } else if (addr == (addr_t) &dummy32->regs.psw.addr) { | 476 | } else if (addr == (addr_t) &dummy32->regs.psw.addr) { |
478 | /* Build a 64 bit psw address from 31 bit address. */ | 477 | /* Build a 64 bit psw address from 31 bit address. */ |
479 | task_pt_regs(child)->psw.addr = | 478 | task_pt_regs(child)->psw.addr = |
@@ -550,7 +549,7 @@ do_ptrace_emu31(struct task_struct *child, long request, long addr, long data) | |||
550 | copied = access_process_vm(child, addr, &tmp, sizeof(tmp), 0); | 549 | copied = access_process_vm(child, addr, &tmp, sizeof(tmp), 0); |
551 | if (copied != sizeof(tmp)) | 550 | if (copied != sizeof(tmp)) |
552 | return -EIO; | 551 | return -EIO; |
553 | return put_user(tmp, (unsigned int __user *) data); | 552 | return put_user(tmp, (unsigned int __force __user *) data); |
554 | 553 | ||
555 | case PTRACE_PEEKUSR: | 554 | case PTRACE_PEEKUSR: |
556 | /* read the word at location addr in the USER area. */ | 555 | /* read the word at location addr in the USER area. */ |
@@ -571,7 +570,7 @@ do_ptrace_emu31(struct task_struct *child, long request, long addr, long data) | |||
571 | 570 | ||
572 | case PTRACE_PEEKUSR_AREA: | 571 | case PTRACE_PEEKUSR_AREA: |
573 | case PTRACE_POKEUSR_AREA: | 572 | case PTRACE_POKEUSR_AREA: |
574 | if (copy_from_user(&parea, (void __user *) addr, | 573 | if (copy_from_user(&parea, (void __force __user *) addr, |
575 | sizeof(parea))) | 574 | sizeof(parea))) |
576 | return -EFAULT; | 575 | return -EFAULT; |
577 | addr = parea.kernel_addr; | 576 | addr = parea.kernel_addr; |
@@ -581,10 +580,11 @@ do_ptrace_emu31(struct task_struct *child, long request, long addr, long data) | |||
581 | if (request == PTRACE_PEEKUSR_AREA) | 580 | if (request == PTRACE_PEEKUSR_AREA) |
582 | ret = peek_user_emu31(child, addr, data); | 581 | ret = peek_user_emu31(child, addr, data); |
583 | else { | 582 | else { |
584 | __u32 tmp; | 583 | __u32 utmp; |
585 | if (get_user (tmp, (__u32 __user *) data)) | 584 | if (get_user(utmp, |
585 | (__u32 __force __user *) data)) | ||
586 | return -EFAULT; | 586 | return -EFAULT; |
587 | ret = poke_user_emu31(child, addr, tmp); | 587 | ret = poke_user_emu31(child, addr, utmp); |
588 | } | 588 | } |
589 | if (ret) | 589 | if (ret) |
590 | return ret; | 590 | return ret; |
@@ -595,17 +595,19 @@ do_ptrace_emu31(struct task_struct *child, long request, long addr, long data) | |||
595 | return 0; | 595 | return 0; |
596 | case PTRACE_GETEVENTMSG: | 596 | case PTRACE_GETEVENTMSG: |
597 | return put_user((__u32) child->ptrace_message, | 597 | return put_user((__u32) child->ptrace_message, |
598 | (unsigned int __user *) data); | 598 | (unsigned int __force __user *) data); |
599 | case PTRACE_GETSIGINFO: | 599 | case PTRACE_GETSIGINFO: |
600 | if (child->last_siginfo == NULL) | 600 | if (child->last_siginfo == NULL) |
601 | return -EINVAL; | 601 | return -EINVAL; |
602 | return copy_siginfo_to_user32((compat_siginfo_t __user *) data, | 602 | return copy_siginfo_to_user32((compat_siginfo_t |
603 | __force __user *) data, | ||
603 | child->last_siginfo); | 604 | child->last_siginfo); |
604 | case PTRACE_SETSIGINFO: | 605 | case PTRACE_SETSIGINFO: |
605 | if (child->last_siginfo == NULL) | 606 | if (child->last_siginfo == NULL) |
606 | return -EINVAL; | 607 | return -EINVAL; |
607 | return copy_siginfo_from_user32(child->last_siginfo, | 608 | return copy_siginfo_from_user32(child->last_siginfo, |
608 | (compat_siginfo_t __user *) data); | 609 | (compat_siginfo_t |
610 | __force __user *) data); | ||
609 | } | 611 | } |
610 | return ptrace_request(child, request, addr, data); | 612 | return ptrace_request(child, request, addr, data); |
611 | } | 613 | } |