[Bug 131] New: struct globals/struct globals2 not portable or safe

bugzilla at busybox.net bugzilla at busybox.net
Wed Feb 25 22:37:42 UTC 2009


https://bugs.busybox.net/show_bug.cgi?id=131

              Host: linux
            Target: 64-bit MIPS
           Summary: struct globals/struct globals2 not portable or safe
           Product: Busybox
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: major
          Priority: P3
         Component: Other
        AssignedTo: unassigned at busybox.net
        ReportedBy: busybox-bugzilla at seebs.net
                CC: busybox-cvs at busybox.net
   Estimated Hours: 0.0


It's possible (at least in 1.11) for t_double to end up misaligned, causing bus
errors.

Underneath it all, the problem is that the trick of declaring two structures
and shoving them next to each other in memory provides no alignment guarantees.
 More generally, it's not a particularly well-designed strategy; there's not
much likely benefit from "small offsets" when you're dealing with structures
this large anyway, and the alignment penalties are probably worse.

The simplest fix would just be to use a single larger 'struct globals' and
trust the compiler.  I have no reason to believe that this elaborate construct
is saving a measurable amount of CPU time.  Alternatively, move t_double to the
beginning of the first 'struct globals' so it forces suitable alignment.


-- 
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


More information about the busybox-cvs mailing list