Re: Clearing the direction flag before calling a signal handler

From: Erik Trulsson <ertr1013_at_student.uu.se>
Date: Sat, 15 Mar 2008 19:13:32 +0100
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_at_ 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 <aurelien aurel32 net>
    PR:     121422
    Reviewed by:    jhb
    MFC after:      2 weeks







-- 
<Insert your favourite quote here.>
Erik Trulsson
ertr1013_at_student.uu.se
Received on Sat Mar 15 2008 - 17:13:39 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:28 UTC