Blob Blame History Raw

commit 64dad6d0d60514498252e6071738fa1b4c12db8c
Author: Dave Anderson <anderson@redhat.com>
Date:   Thu Nov 29 14:21:19 2018 -0500

    Fix for the "ps -s" option on ARM64 if the number of tasks exceeds
    2000.  Without the patch, the command ultimately fails with a
    dump of the internal buffer allocation stats, followed by the
    message "ps: cannot allocate any more memory!".
    (anderson@redhat.com)

diff -up crash-7.2.3/task.c.orig crash-7.2.3/task.c
--- crash-7.2.3/task.c.orig	2018-11-29 13:54:39.108320730 -0500
+++ crash-7.2.3/task.c	2018-11-29 13:54:48.598279086 -0500
@@ -4133,6 +4133,10 @@ task_pointer_string(struct task_context
         		readmem(tc->task + OFFSET(task_struct_thread_ksp), 
 				KVADDR, &bt->stkptr, sizeof(void *),
                 		"thread_struct ksp", FAULT_ON_ERROR);
+		} else if (VALID_MEMBER(task_struct_thread_context_sp)) {
+			readmem(tc->task + OFFSET(task_struct_thread_context_sp), 
+				KVADDR, &bt->stkptr, sizeof(void *),
+				"cpu_context sp", FAULT_ON_ERROR);
 		} else {
 			if ((bt->stackbase = GET_STACKBASE(tc->task))) {
 				bt->stacktop = GET_STACKTOP(tc->task);
@@ -4140,6 +4144,8 @@ task_pointer_string(struct task_context
 				bt->tc = tc;
 				bt->flags |= BT_KSTACKP;
 				back_trace(bt);
+				if (bt->stackbuf)
+					FREEBUF(bt->stackbuf);
 			} else
 				bt->stkptr = 0;
 		}