From owner-svn-src-head@FreeBSD.ORG Sat May 11 22:32:44 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 5810C82E; Sat, 11 May 2013 22:32:44 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 493C0D2C; Sat, 11 May 2013 22:32:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r4BMWiIu000473; Sat, 11 May 2013 22:32:44 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r4BMWiUW000472; Sat, 11 May 2013 22:32:44 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <201305112232.r4BMWiUW000472@svn.freebsd.org> From: Tim Kientzle Date: Sat, 11 May 2013 22:32:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r250531 - head/sys/arm/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 May 2013 22:32:44 -0000 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); }