develooper Front page | perl.perl5.porters | Postings from July 2009

Re: [perl #60574] sv_upgrade() loses 64-bit alignment, causingSIGBUS on sparc

Thread Previous
From:
Niko Tyni
Date:
July 23, 2009 02:07
Subject:
Re: [perl #60574] sv_upgrade() loses 64-bit alignment, causingSIGBUS on sparc
Message ID:
20090723073448.GA12004@kuusama.it.helsinki.fi
On Fri, Jul 17, 2009 at 08:44:40PM +0100, Nicholas Clark wrote:
> On Mon, Nov 17, 2008 at 08:52:28PM +0200, Niko Tyni wrote:
> > On Mon, Nov 17, 2008 at 03:44:18PM +0000, Nicholas Clark wrote:
> > > On Sun, Nov 16, 2008 at 08:17:17PM +0200, Niko Tyni wrote:
> > > > On Sun, Nov 16, 2008 at 05:15:36PM +0000, Nicholas Clark wrote:
> > > > > On Sun, Nov 16, 2008 at 04:16:14AM -0800, Niko Tyni wrote:
> > > > > 
> > > > > > As seen in <http://bugs.debian.org/505415>, calling sv_chop() or otherwise
> > > > > > upgrading an SV can result in an unaligned 64-bit access on the sparc
> > > > > > architecture.
> > > > 
> > > > > What is __alignof__(XPVIV) and sizeof(XPVIV) on the same system?
> > > > 
> > > > 8 and 24.
> > > 
> > > whereas __alignof__(xpv_allocated) and sizeof(xpv_allocated) are 8 and 4,
> > > and __alignof__(xpviv_allocated) and sizeof(xpviv_allocated) are 12 and 4?

> Sorry for the delay. Does change 69ba284b5e077075f1211a1053a11dae403648fd
> fix it? It's currently in blead, but it should be suitable to merge to
> maint-5.10. It replaces the *_allocated structs with a construction using
> STRUCT_OFFSET().

Yes, I can confirm it fixes it all for me on both blead and maint-5.10,
including the original problem (failing JSON-XS test suite on maint-5.10).

> I don't have access to sparc Debian, but I do have limited acces to sparc
> Solaris 9 (with gcc). On that, running the appended script I see

This is the output on maint-5.10 here:

XPV                                                 16  8
xpv_allocated                                       8   4
sizeof(XPV) - STRUCT_OFFSET(XPV, xpv_cur)           8

XPVIV                                               24  8
xpviv_allocated                                     12  4
sizeof(XPVIV) - STRUCT_OFFSET(XPVIV, xpv_cur)       16

XPVAV                                               32  8
xpvav_allocated                                     20  4
sizeof(XPVAV) - STRUCT_OFFSET(XPVAV, xav_fill)      24

XPVHV                                               32  8
xpvhv_allocated                                     20  4
sizeof(XPVHV) - STRUCT_OFFSET(XPVHV, xhv_fill)      24

XPVCV                                               64  8
xpvcv_allocated                                     56  4
sizeof(XPVCV) - STRUCT_OFFSET(XPVCV, xpv_cur)       56

XPVFM                                               72  8
xpvfm_allocated                                     60  4
sizeof(XPVFM) - STRUCT_OFFSET(XPVFM, xpv_cur)       64

Many thanks for your work! Much appreciated.
-- 
Niko Tyni   ntyni@debian.org

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About