[Crash-utility] bt -f fix for s390(x)

Michael Holzheu holzheu at de.ibm.com
Mon Jul 3 15:03:24 UTC 2006


Hi Dave,

Here comes a fix for the bt -f command. 

The problem is that when the backchain is invalid on s390(x) we can get huge values for the stackframe size. This can lead to a termination of crash with a SIGSEGV. To fix this, we have to use in case of an invalid backchain the difference between the current backchain and the end of the stack as stackframe size.

---

diff -Naur crash-4.0-2.31/s390.c crash-4.0-2.31-s390-bt-f.fix/s390.c
--- crash-4.0-2.31/s390.c	2006-06-27 16:15:32.000000000 +0200
+++ crash-4.0-2.31-s390-bt-f.fix/s390.c	2006-07-03 16:37:34.000000000 +0200
@@ -714,7 +714,9 @@
 				frame_size = stack_base - old_backchain 
 					     + KERNEL_STACK_SIZE;
 			} else {
-				frame_size = backchain - old_backchain;
+				frame_size = MIN((backchain - old_backchain),
+					(stack_base - old_backchain +
+					KERNEL_STACK_SIZE));
 			}
 			for(j=0; j< frame_size; j+=4){
 				if(j % 16 == 0){
diff -Naur crash-4.0-2.31/s390x.c crash-4.0-2.31-s390-bt-f.fix/s390x.c
--- crash-4.0-2.31/s390x.c	2006-06-27 16:15:32.000000000 +0200
+++ crash-4.0-2.31-s390-bt-f.fix/s390x.c	2006-07-03 16:37:37.000000000 +0200
@@ -747,7 +747,9 @@
 				frame_size = stack_base - old_backchain 
 					     + KERNEL_STACK_SIZE;
 			} else {
-				frame_size = backchain - old_backchain;
+				frame_size = MIN((backchain - old_backchain),
+					(stack_base - old_backchain +
+					KERNEL_STACK_SIZE));
 			}
 			for(j=0; j< frame_size; j+=4){
 				if(j % 16 == 0){




More information about the Crash-utility mailing list