diff options
Diffstat (limited to 'arch/ia64/kernel/ptrace.c')
-rw-r--r-- | arch/ia64/kernel/ptrace.c | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/arch/ia64/kernel/ptrace.c b/arch/ia64/kernel/ptrace.c index 55789fcd7210..9e730c7bf0cd 100644 --- a/arch/ia64/kernel/ptrace.c +++ b/arch/ia64/kernel/ptrace.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/user.h> | 17 | #include <linux/user.h> |
18 | #include <linux/security.h> | 18 | #include <linux/security.h> |
19 | #include <linux/audit.h> | 19 | #include <linux/audit.h> |
20 | #include <linux/signal.h> | ||
20 | 21 | ||
21 | #include <asm/pgtable.h> | 22 | #include <asm/pgtable.h> |
22 | #include <asm/processor.h> | 23 | #include <asm/processor.h> |
@@ -704,12 +705,32 @@ convert_to_non_syscall (struct task_struct *child, struct pt_regs *pt, | |||
704 | break; | 705 | break; |
705 | } | 706 | } |
706 | 707 | ||
708 | /* | ||
709 | * Note: at the time of this call, the target task is blocked | ||
710 | * in notify_resume_user() and by clearling PRED_LEAVE_SYSCALL | ||
711 | * (aka, "pLvSys") we redirect execution from | ||
712 | * .work_pending_syscall_end to .work_processed_kernel. | ||
713 | */ | ||
707 | unw_get_pr(&prev_info, &pr); | 714 | unw_get_pr(&prev_info, &pr); |
708 | pr &= ~(1UL << PRED_SYSCALL); | 715 | pr &= ~((1UL << PRED_SYSCALL) | (1UL << PRED_LEAVE_SYSCALL)); |
709 | pr |= (1UL << PRED_NON_SYSCALL); | 716 | pr |= (1UL << PRED_NON_SYSCALL); |
710 | unw_set_pr(&prev_info, pr); | 717 | unw_set_pr(&prev_info, pr); |
711 | 718 | ||
712 | pt->cr_ifs = (1UL << 63) | cfm; | 719 | pt->cr_ifs = (1UL << 63) | cfm; |
720 | /* | ||
721 | * Clear the memory that is NOT written on syscall-entry to | ||
722 | * ensure we do not leak kernel-state to user when execution | ||
723 | * resumes. | ||
724 | */ | ||
725 | pt->r2 = 0; | ||
726 | pt->r3 = 0; | ||
727 | pt->r14 = 0; | ||
728 | memset(&pt->r16, 0, 16*8); /* clear r16-r31 */ | ||
729 | memset(&pt->f6, 0, 6*16); /* clear f6-f11 */ | ||
730 | pt->b7 = 0; | ||
731 | pt->ar_ccv = 0; | ||
732 | pt->ar_csd = 0; | ||
733 | pt->ar_ssd = 0; | ||
713 | } | 734 | } |
714 | 735 | ||
715 | static int | 736 | static int |
@@ -1481,7 +1502,7 @@ sys_ptrace (long request, pid_t pid, unsigned long addr, unsigned long data) | |||
1481 | case PTRACE_CONT: | 1502 | case PTRACE_CONT: |
1482 | /* restart after signal. */ | 1503 | /* restart after signal. */ |
1483 | ret = -EIO; | 1504 | ret = -EIO; |
1484 | if (data > _NSIG) | 1505 | if (!valid_signal(data)) |
1485 | goto out_tsk; | 1506 | goto out_tsk; |
1486 | if (request == PTRACE_SYSCALL) | 1507 | if (request == PTRACE_SYSCALL) |
1487 | set_tsk_thread_flag(child, TIF_SYSCALL_TRACE); | 1508 | set_tsk_thread_flag(child, TIF_SYSCALL_TRACE); |
@@ -1520,7 +1541,7 @@ sys_ptrace (long request, pid_t pid, unsigned long addr, unsigned long data) | |||
1520 | /* let child execute for one instruction */ | 1541 | /* let child execute for one instruction */ |
1521 | case PTRACE_SINGLEBLOCK: | 1542 | case PTRACE_SINGLEBLOCK: |
1522 | ret = -EIO; | 1543 | ret = -EIO; |
1523 | if (data > _NSIG) | 1544 | if (!valid_signal(data)) |
1524 | goto out_tsk; | 1545 | goto out_tsk; |
1525 | 1546 | ||
1526 | clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); | 1547 | clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); |