From owner-freebsd-current@FreeBSD.ORG Thu Dec 28 23:05:05 2006 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id AF2B316A403 for ; Thu, 28 Dec 2006 23:05:05 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (66-23-211-162.clients.speedfactory.net [66.23.211.162]) by mx1.freebsd.org (Postfix) with ESMTP id 3075313C48A for ; Thu, 28 Dec 2006 23:05:05 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from zion.baldwin.cx (zion.baldwin.cx [192.168.0.7]) (authenticated bits=0) by server.baldwin.cx (8.13.6/8.13.6) with ESMTP id kBSN3FSv068908; Thu, 28 Dec 2006 18:03:15 -0500 (EST) (envelope-from jhb@freebsd.org) From: John Baldwin To: freebsd-current@freebsd.org Date: Thu, 28 Dec 2006 17:53:15 -0500 User-Agent: KMail/1.9.4 References: <20061219175917.L84683@atlantis.atlantis.dp.ua> <20061220215753.H53808@atlantis.atlantis.dp.ua> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200612281753.16977.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [192.168.0.1]); Thu, 28 Dec 2006 18:03:16 -0500 (EST) X-Virus-Scanned: ClamAV 0.88.3/2389/Thu Dec 28 12:39:35 2006 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=4.2 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: Dmitry Pryanishnikov , Kip Macy , Kostik Belousov Subject: Re: ddb(4) spoils kernel stack in CURRENT? 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: Thu, 28 Dec 2006 23:05:05 -0000 On Wednesday 20 December 2006 15:41, Kip Macy wrote: > I worried that gdb probably had workaround for the large stack argument. > I'll have to dig it up, thanks for the heads up. Both kgdb and ddb have explicit knowledge of trapframes and interrupt frames and know how to step across them, so both of those will need to be updated. For ddb, you'll have to update the 'db_nextframe()' function in sys/{amd64,i386}/{amd64,i386}/db_trace.c. Specifically this section: /* * Point to base of trapframe which is just above the * current frame. */ if (frame_type == INTERRUPT) tf = (struct trapframe *)((int)*fp + 12); else tf = (struct trapframe *)((int)*fp + 8); The easy change is to just bump those up by 4 (by 8 on amd64). Similarly, for kgdb you'll have to update src/gnu/usr.bin/gdb/kgdb/trgt_{amd64,i386}.c. NB: kgdb doesn't properly distinguish interrupt frames from other trap frames. It treats nearly all trap frames as interrupt frames (though its handling of interrupt frames is more like a trap frame I think). > -Kip > > On 12/20/06, Dmitry Pryanishnikov wrote: > > > > > > Hello! > > > > On Wed, 20 Dec 2006, Kostik Belousov wrote: > > >>> So it looks like a regression in CURRENT vs RELENG_6 (either ddb > > 'spoils' > > >>> the stack somehow, or kgdb fails to unwind it). > > > > > > Could you further localize the problem, i.e. try to backtrace CURRENT > > dump > > > > Good news: I've managed to localize the bug! I'm Feeling Lucky (TM) ;) > > just because CURRENT on my notebook was updated approx. at 17-Dec 00:00, > > and it didn't manifest such a behaviour! So it was easy to identify the > > regression - it comes with the following commit: > > > > ----------------------------------------------------------------------- > > > > Date: Sun, 17 Dec 2006 05:07:01 +0000 (UTC) > > From: Kip Macy > > To: src-committers@freebsd.org, cvs-src@freebsd.org, cvs-all@freebsd.org > > Subject: cvs commit: src/sys/i386/i386 apic_vector.s exception.slocal_apic.c > > trap.c vm86.c vm86bios.s src/sys/i386/include apicvar.h > > src/sys/i386/isa atpic.c atpic_vector.s icu.h > > > > kmacy 2006-12-17 05:07:01 UTC > > > > FreeBSD src repository > > > > Modified files: > > sys/i386/i386 apic_vector.s exception.s local_apic.c > > trap.c vm86.c vm86bios.s > > sys/i386/include apicvar.h > > sys/i386/isa atpic.c atpic_vector.s icu.h > > Log: > > Evidently FreeBSD has long relied on the compiler to treat structures > > passed by value (trap frames) as if they were in fact being passed by > > reference. For better or worse, this incorrect behaviour is no longer > > present in gcc 4.1. In this patch I convert all trapframe arguments to > > be explicitly pass by reference. I also remove vm86_initflags, pushing > > the very little work that it actually does up into vm86_prepcall. > > > > ----------------------------------------------------------------------- > > > > So kernel built from sources as of date=2006.12.17.05.00.00 gives dump > > with analyzable backtrace, and kernel built from sources as of > > date=2006.12.17.05.10.00 (which include this commit) gives dump > > which confuses kgdb. I believe that commit itself is correct, > > but kgdb contains some workaround against the old (incorrect) behaviour > > of the kernel, so it's the kgdb that should be fixed. > > > > Sincerely, Dmitry > > -- > > Atlantis ISP, System Administrator > > e-mail: dmitry@atlantis.dp.ua > > nic-hdl: LYNX-RIPE > > _______________________________________________ > > freebsd-current@freebsd.org mailing list > > http://lists.freebsd.org/mailman/listinfo/freebsd-current > > To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org" > > > _______________________________________________ > freebsd-current@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-current > To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org" > -- John Baldwin