[IA64] Correct convert_to_non_syscall()

convert_to_non_syscall() has the same problem that unwind_to_user()
used to have. Fix it likewise.

Signed-off-by: David Mosberger-Tang <davidm@hpl.hp.com>
Signed-off-by: Tony Luck <tony.luck@intel.com>

authored by

David Mosberger-Tang and committed by
Tony Luck
02a017a9 d0dac808

+17 -3
+17 -3
arch/ia64/kernel/ptrace.c
··· 692 692 unsigned long cfm) 693 693 { 694 694 struct unw_frame_info info, prev_info; 695 - unsigned long ip, pr; 695 + unsigned long ip, sp, pr; 696 696 697 697 unw_init_from_blocked_task(&info, child); 698 698 while (1) { 699 699 prev_info = info; 700 700 if (unw_unwind(&info) < 0) 701 701 return; 702 - if (unw_get_rp(&info, &ip) < 0) 702 + 703 + unw_get_sp(&info, &sp); 704 + if ((long)((unsigned long)child + IA64_STK_OFFSET - sp) 705 + < IA64_PT_REGS_SIZE) { 706 + dprintk("ptrace.%s: ran off the top of the kernel " 707 + "stack\n", __FUNCTION__); 703 708 return; 704 - if (ip < FIXADDR_USER_END) 709 + } 710 + if (unw_get_pr (&prev_info, &pr) < 0) { 711 + unw_get_rp(&prev_info, &ip); 712 + dprintk("ptrace.%s: failed to read " 713 + "predicate register (ip=0x%lx)\n", 714 + __FUNCTION__, ip); 715 + return; 716 + } 717 + if (unw_is_intr_frame(&info) 718 + && (pr & (1UL << PRED_USER_STACK))) 705 719 break; 706 720 } 707 721