From owner-freebsd-current@FreeBSD.ORG Sat Mar 15 18:13:39 2008 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 15B0A106566C for ; Sat, 15 Mar 2008 18:13:39 +0000 (UTC) (envelope-from erikt@midgard.homeip.net) Received: from ch-smtp01.sth.basefarm.net (ch-smtp01.sth.basefarm.net [80.76.149.212]) by mx1.freebsd.org (Postfix) with ESMTP id ADA9E8FC20 for ; Sat, 15 Mar 2008 18:13:38 +0000 (UTC) (envelope-from erikt@midgard.homeip.net) Received: from c83-253-25-183.bredband.comhem.se ([83.253.25.183]:64644 helo=falcon.midgard.homeip.net) by ch-smtp01.sth.basefarm.net with esmtp (Exim 4.68) (envelope-from ) id 1Jaasx-0000Et-5I for freebsd-current@freebsd.org; Sat, 15 Mar 2008 19:13:37 +0100 Received: (qmail 56736 invoked from network); 15 Mar 2008 19:13:32 +0100 Received: from owl.midgard.homeip.net (10.1.5.7) by falcon.midgard.homeip.net with ESMTP; 15 Mar 2008 19:13:32 +0100 Received: (qmail 7544 invoked by uid 1001); 15 Mar 2008 19:13:32 +0100 Date: Sat, 15 Mar 2008 19:13:32 +0100 From: Erik Trulsson To: Peter Schuller Message-ID: <20080315181331.GA7454@owl.midgard.homeip.net> Mail-Followup-To: Peter Schuller , freebsd-current@freebsd.org References: <200803151852.04116.peter.schuller@infidyne.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200803151852.04116.peter.schuller@infidyne.com> User-Agent: Mutt/1.5.17 (2007-11-01) X-Originating-IP: 83.253.25.183 X-Scan-Result: No virus found in message 1Jaasx-0000Et-5I. X-Scan-Signature: ch-smtp01.sth.basefarm.net 1Jaasx-0000Et-5I a2ff9ed34abe6ad63cb3bfbfbc2b68a2 Cc: freebsd-current@freebsd.org Subject: Re: Clearing the direction flag before calling a signal handler 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: Sat, 15 Mar 2008 18:13:39 -0000 On Sat, Mar 15, 2008 at 06:51:53PM +0100, Peter Schuller wrote: > Hello, > > I found an exchange concerning a difficult to debug problem that may be > affecting FreeBSD. I wasn't sure whether to post here or just file a bug, but > under the circumstances I opted for the former. Apologies if it is considered > noise. > > I was reading the exchange here: > > http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=469058 > > Referencing the following patch to Linux; > > http://lkml.org/lkml/2008/3/5/306 > > The exchange in the Debian bug tracker indicates kfreebsd 6/7 has the same > problem as Linux. Being a kernel issue, that indicates vanilla FreeBSD may > likely be affected. > > I neither have the setup nor the knowledge to effectively evaluate this > myself, but felt that it was obscure/diagnostically difficult enough that i > wanted to bring it to somebody's attention. > There was also a long discussion on the gcc developers list about this issue recently. It seems to already have been taken care of in FreeBSD by the following commit to -CURRENT: kib 2008-03-13 10:54:38 UTC FreeBSD src repository Modified files: sys/amd64/amd64 machdep.c sys/amd64/ia32 ia32_signal.c sys/amd64/linux32 linux32_sysvec.c sys/i386/i386 machdep.c sys/i386/linux linux_sysvec.c sys/i386/svr4 svr4_machdep.c sys/pc98/pc98 machdep.c Log: Since version 4.3, gcc changed its behaviour concerning the i386/amd64 ABI and the direction flag, that is it now assumes that the direction flag is cleared at the entry of a function and it doesn't clear once more if needed. This new behaviour conforms to the i386/amd64 ABI. Modify the signal handler frame setup code to clear the DF {e,r}flags bit on the amd64/i386 for the signal handlers. jhb@ noted that it might break old apps if they assumed DF == 1 would be preserved in the signal handlers, but that such apps should be rare and that older versions of gcc would not generate such apps. Submitted by: Aurelien Jarno PR: 121422 Reviewed by: jhb MFC after: 2 weeks -- Erik Trulsson ertr1013@student.uu.se