Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 11 May 2013 22:32:44 +0000 (UTC)
From:      Tim Kientzle <kientzle@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r250531 - head/sys/arm/arm
Message-ID:  <201305112232.r4BMWiUW000472@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kientzle
Date: Sat May 11 22:32:43 2013
New Revision: 250531
URL: http://svnweb.freebsd.org/changeset/base/250531

Log:
  Don't use the old stack-walking code with
  EABI ARM kernels or clang-compiled ARM kernels.
  
  This fixes a crash seen in clang-compiled ARM
  kernels that include WITNESS.
  
  This code could be easily modified to walk the stack
  for current clang-generated code (including EABI)
  but Andrew Turner has raised concerns that the
  stack frame currently emitted by clang isn't actually
  required by EABI so such a change might cause problems
  down the road.
  
  In case anyone wants to experiment, the change
  to support current clang-compiled kernels
  involves simply setting FR_RFP=0 and FR_SCP=1.

Modified:
  head/sys/arm/arm/stack_machdep.c

Modified: head/sys/arm/arm/stack_machdep.c
==============================================================================
--- head/sys/arm/arm/stack_machdep.c	Sat May 11 22:13:24 2013	(r250530)
+++ head/sys/arm/arm/stack_machdep.c	Sat May 11 22:32:43 2013	(r250531)
@@ -39,17 +39,16 @@ __FBSDID("$FreeBSD$");
 static void
 stack_capture(struct stack *st, u_int32_t *frame)
 {
+#if !defined(__ARM_EABI__) && !defined(__clang__)
 	vm_offset_t callpc;
 
-	stack_zero(st);
-	while (1) {
-		if (!INKERNEL(frame))
-			break;
+	while (INKERNEL(frame)) {
 		callpc = frame[FR_SCP];
 		if (stack_put(st, callpc) == -1)
 			break;
 		frame = (u_int32_t *)(frame[FR_RFP]);
 	}
+#endif
 }
 
 void
@@ -63,6 +62,7 @@ stack_save_td(struct stack *st, struct t
 		panic("stack_save_td: running");
 
 	frame = (u_int32_t *)td->td_pcb->un_32.pcb32_r11;
+	stack_zero(st);
 	stack_capture(st, frame);
 }
 
@@ -72,5 +72,6 @@ stack_save(struct stack *st)
 	u_int32_t *frame;
 
 	frame = (u_int32_t *)__builtin_frame_address(0);
+	stack_zero(st);
 	stack_capture(st, frame);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201305112232.r4BMWiUW000472>