NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: port-i386/39299: FPU use in signal handlers is unsafe

The following reply was made to PR port-i386/39299; it has been noted by GNATS.

From: Michael van Elst <>
Subject: Re: port-i386/39299: FPU use in signal handlers is unsafe
Date: Thu, 24 Sep 2009 19:58:55 +0200

 The same problem exists in netbsd-4, this breaks the current
 modular-xorg-server from pkgsrc as X processes all input in
 a SIGIO handler and fails to compute mouse movements (in
 floating pointer).
 A similar patch solves the problem here and I am preparing
 a pullup.
 -current/amd64 seems to have the same problem, at least when
 running 32bit binaries. The signal handler uses the FPU state
 as it was left by the main program.
 When analyzing the problem I found that the FPU save frame
 as defined in i386/include/npx.h has one field wrong. The
 tag word is 16bit with the 8 lower bits (first byte, LSB!)
 being valid. If I'm not mistaken it should be like:
 struct envxmm {
 /*0*/   uint16_t en_cw;         /* FPU Control Word */
         uint16_t en_sw;         /* FPU Status Word */
         uint8_t  en_tw;         /* FPU Tag Word (abridged) */
         uint8_t  en_rsvd0;
                                 Michael van Elst
                                 "A potential Snark may lurk in every tree."

Home | Main Index | Thread Index | Old Index