From owner-freebsd-current@FreeBSD.ORG Tue Jun 20 15:31:12 2006 Return-Path: X-Original-To: current@freebsd.org Delivered-To: freebsd-current@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 021AC16A47E for ; Tue, 20 Jun 2006 15:31:12 +0000 (UTC) (envelope-from kientzle@freebsd.org) Received: from kientzle.com (h-66-166-149-50.snvacaid.covad.net [66.166.149.50]) by mx1.FreeBSD.org (Postfix) with ESMTP id A296243D45 for ; Tue, 20 Jun 2006 15:31:11 +0000 (GMT) (envelope-from kientzle@freebsd.org) Received: from [10.0.0.221] (p54.kientzle.com [66.166.149.54]) by kientzle.com (8.12.9/8.12.9) with ESMTP id k5KFUoOZ046191; Tue, 20 Jun 2006 08:30:54 -0700 (PDT) (envelope-from kientzle@freebsd.org) Message-ID: <449814AA.90307@freebsd.org> Date: Tue, 20 Jun 2006 08:30:50 -0700 From: Tim Kientzle User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.12) Gecko/20060422 X-Accept-Language: en-us, en MIME-Version: 1.0 To: "Andrew R. Reiter" References: <20060618192011.GF715@turion.vk2pj.dyndns.org> <20060618152428.A36995@fledge.watson.org> <20060619184540.GJ23729@comp.chem.msu.su> <20060619190822.GE966@turion.vk2pj.dyndns.org> <20060619221550.GM23729@comp.chem.msu.su> <20060619181929.W40529@fledge.watson.org> In-Reply-To: <20060619181929.W40529@fledge.watson.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Cc: Yar Tikhiy , current@freebsd.org Subject: Re: NULL pointer dereference panic X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Jun 2006 15:31:12 -0000 Andrew R. Reiter wrote: > On Tue, 20 Jun 2006, Yar Tikhiy wrote: > > :On Tue, Jun 20, 2006 at 05:08:22AM +1000, Peter Jeremy wrote: > :> On Mon, 2006-Jun-19 22:45:41 +0400, Yar Tikhiy wrote: > :> >Peter, what gcc options did you build the kernel with? My question > :> >is unrelated to the panic, I'd just like to make stack traces look > :> >sane in common cases :-) > :> > : > :When in basic i386 mode, gcc calls functions in the traditional > :way. E.g., the "foo(1, 2)" call will look as follows in asm: > : > : pushl $2 > : pushl $1 > : call foo > : addl $8, %esp > : > :By merely decoding the addl instruction at the return pointer we > :can find how many words of arguments the called function takes. I'm not sure which -O flags enable this, but I've certainly seen lazy stack cleanups in gcc-generated code on i386: pushl $2 pushl $1 call foo pushl $3 pushl $4 call foo addl $16, %esp This optimization would also confuse the stack-tracing logic you describe. Tim