[PATCH] do not check sp if ip points to user space

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If the task is a user program, the sp can be points to anywhere,
because we can modify sp in assembly.
For example:

.globl main
        .type   main, @function
main:

        finit
        subq $16, (%rsp)
        movq $0, (%rsp)
.loop:
        jmp .loop

>From 54c6731785ee6edbe684dc15ece5b56a074f5847 Mon Sep 17 00:00:00 2001
From: Wen Congyang <wency@xxxxxxxxxxxxxx>
Date: Fri, 23 Sep 2011 02:18:21 -0400
Subject: [PATCH] do not check sp if ip points to user space

---
 kvmdump.c |    3 +--
 netdump.c |    2 +-
 x86_64.c  |    2 +-
 3 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/kvmdump.c b/kvmdump.c
index 451145b..10160c7 100644
--- a/kvmdump.c
+++ b/kvmdump.c
@@ -438,8 +438,7 @@ get_kvmdump_regs(struct bt_info *bt, ulong *ipp, ulong *spp)
 		return;
 	}
 
-	if (!is_kernel_text(ip) && 
-	    in_user_stack(bt->tc->task, sp))
+	if (!is_kernel_text(ip))
 		bt->flags |= BT_USER_SPACE;
 }
 
diff --git a/netdump.c b/netdump.c
index 1e9960c..2039342 100644
--- a/netdump.c
+++ b/netdump.c
@@ -2513,7 +2513,7 @@ next_sysrq:
 			return;
 		}
 
-		if (!is_kernel_text(ip) && in_user_stack(bt->tc->task, sp)) {
+		if (!is_kernel_text(ip)) {
 			bt->flags |= BT_USER_SPACE;
 			*eip = ip;
 			*esp = sp;
diff --git a/x86_64.c b/x86_64.c
index 7296ec5..51ebf4f 100644
--- a/x86_64.c
+++ b/x86_64.c
@@ -4374,7 +4374,7 @@ skip_stage:
 	if (ur_rip && ur_rsp) {
         	*rip = ur_rip;
 		*rsp = ur_rsp;
-		if (!is_kernel_text(ur_rip) && in_user_stack(bt->tc->task, ur_rsp))
+		if (!is_kernel_text(ur_rip))
 			bt_in->flags |= BT_USER_SPACE;
 		return;
 	}
-- 
1.7.1

--
Crash-utility mailing list
Crash-utility@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/crash-utility

[Index of Archives]     [Fedora Development]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]

 

Powered by Linux