[Crash-utility] [PATCH v3 03/10] back_trace: don't check /proc if !LOCAL_ACTIVE()

Oleg Nesterov oleg at redhat.com
Thu Apr 28 16:58:27 UTC 2016


On 04/28, Dave Anderson wrote:
>
> > IOW. with the patch above the code actually does
> >
> > 	if (ACTIVE() && !INSTACK(...)) {
> > 		if (LOCAL_ACTIVE() && file_exists(...))
> > 			error("invalid/stale stack pointer");
> > 		else
> > 			error("task no longer exists\n");
> > 	}
> >
> > is it wrong?
> >
> > I thought that !INSTACK() here likely means the task has gone, but back_trace()
> > does the additional file_exists() to verify this, and "invalid/stale stack pointer"
> > error means that something was wrong.
> >
> > No?
>
> I can't even remember -- that code's been in place for so long I'd prefer to just
> leave it as-is, and for you to just add something like this:
>
>         if (ACTIVE() && !INSTACK(esp, bt)) {
> +               if (!(LOCAL_ACTIVE()) }
> +                       error(INFO, "whatever error message you'd like\n");
> +                       return;
> +               }

OK.

-------------------------------------------------------------------------------
Subject: [PATCH v3 03/10] back_trace: don't check /proc if !LOCAL_ACTIVE()

Obviously the /proc/$tc->pid check can only make sense if LOCAL_ACTIVE().

Signed-off-by: Oleg Nesterov <oleg at redhat.com>
---
 kernel.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/kernel.c b/kernel.c
index a6fa7a6..c82b854 100644
--- a/kernel.c
+++ b/kernel.c
@@ -2901,6 +2901,10 @@ back_trace(struct bt_info *bt)
 	}
 
 	if (ACTIVE() && !INSTACK(esp, bt)) {
+		if (!LOCAL_ACTIVE()) {
+			error(INFO, "task no longer exists\n");
+			return;
+		}
 		sprintf(buf, "/proc/%ld", bt->tc->pid); 
 		if (!file_exists(buf, NULL))
 			error(INFO, "task no longer exists\n");
-- 
2.5.0





More information about the Crash-utility mailing list