[IA64] Sanity check unw_unwind_to_user

Linux Kernel Mailing List <[email protected]> Sat, 12 Mar 2005 22:38:27 +0000
Newsgroups gmane.linux.kernel.commits.2-4
Message-ID <[email protected]>
ChangeSet 1.1462, 2005/03/12 15:38:27-07:00, [email protected]

	[IA64] Sanity check unw_unwind_to_user
	
	Signed-off-by: Keith Owens <[email protected]>
	Signed-off-by: Tony Luck <[email protected]>



 unwind.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletion(-)


diff -Nru a/arch/ia64/kernel/unwind.c b/arch/ia64/kernel/unwind.c
--- a/arch/ia64/kernel/unwind.c	2005-03-24 09:05:01 -08:00
+++ b/arch/ia64/kernel/unwind.c	2005-03-24 09:05:01 -08:00
@@ -1916,7 +1916,7 @@
 int
 unw_unwind_to_user (struct unw_frame_info *info)
 {
-	unsigned long ip;
+	unsigned long ip, sp;
 
 	while (unw_unwind(info) >= 0) {
 		if (unw_get_rp(info, &ip) < 0) {
@@ -1925,6 +1925,9 @@
 				   __FUNCTION__, ip);
 			return -1;
 		}
+		unw_get_sp(info, &sp);
+		if (sp >= (unsigned long)info->task + IA64_STK_OFFSET)
+			break;
 		/*
 		 * We don't have unwind info for the gate page, so we consider that part
 		 * of user-space for the purpose of unwinding.