NetBSD Problem Report #30106
From www@netbsd.org Sun May 1 09:20:59 2005
Return-Path: <www@netbsd.org>
Received: by narn.netbsd.org (Postfix, from userid 31301)
id A783763B116; Sun, 1 May 2005 09:20:59 +0000 (UTC)
Message-Id: <20050501092059.A783763B116@narn.netbsd.org>
Date: Sun, 1 May 2005 09:20:59 +0000 (UTC)
From: segv@netctl.net
Reply-To: segv@netctl.net
To: gnats-bugs@netbsd.org
Subject: www/firefox failes to install with 'Bus error' on UltraSparc machines
X-Send-Pr-Version: www-1.0
>Number: 30106
>Category: pkg
>Synopsis: www/firefox failes to install with 'Bus error' on UltraSparc machines
>Confidential: no
>Severity: critical
>Priority: high
>Responsible: taya
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun May 01 09:21:00 +0000 2005
>Closed-Date: Thu Oct 12 22:53:26 +0000 2006
>Last-Modified: Thu Oct 12 22:53:26 +0000 2006
>Originator: SEGV
>Release:
>Organization:
>Environment:
SunOS u10 5.10 Generic sun4u sparc SUNW,Ultra-5_10
>Description:
www/firefox has alignment issues on 64-bit architectures like UltraSparc. It builds fine from pkgsrc, but when it comes to installing and registering components it fails with 'Bus error'
Other programs based on Mozilla are likeley to have the same problems and should incorporate the patch given below.
>How-To-Repeat:
>Fix:
Apply the following patch to fix the alignment issues:
*** extensions/transformiix/source/base/Double.cpp.orig Wed Mar 16 17:58:58 2005
--- extensions/transformiix/source/base/Double.cpp Wed Mar 16 17:59:16 2005
***************
*** 116,130 ****
--- 116,173 ----
//-- Initialize Double related constants
#ifdef IS_BIG_ENDIAN
+ /*
const PRUint32 nanMask[2] = {TX_DOUBLE_HI32_EXPMASK | TX_DOUBLE_HI32_MANTMASK,
0xffffffff};
const PRUint32 infMask[2] = {TX_DOUBLE_HI32_EXPMASK, 0};
const PRUint32 negInfMask[2] = {TX_DOUBLE_HI32_EXPMASK | TX_DOUBLE_HI32_SIGNBIT, 0};
+ */
+
+ /* alignment needs to be to 'double' datatype */
+ union {
+ const PRUint32 nanMask[2];
+ double dummy;
+ } un_nanMask = { {TX_DOUBLE_HI32_EXPMASK | TX_DOUBLE_HI32_MANTMASK, 0xffffffff} };
+ #define nanMask (un_nanMask.nanMask)
+
+ union {
+ const PRUint32 infMask[2];
+ double dummy;
+ } un_infMask = { {TX_DOUBLE_HI32_EXPMASK, 0} };
+ #define infMask (un_infMask.infMask)
+
+ union {
+ const PRUint32 negInfMask[2];
+ double dummy;
+ } un_negInfMask = { {TX_DOUBLE_HI32_EXPMASK | TX_DOUBLE_HI32_SIGNBIT, 0} };
+ #define negInfMask (un_negInfMask.negInfMask)
+
#else
+ /*
const PRUint32 nanMask[2] = {0xffffffff,
TX_DOUBLE_HI32_EXPMASK | TX_DOUBLE_HI32_MANTMASK};
const PRUint32 infMask[2] = {0, TX_DOUBLE_HI32_EXPMASK};
const PRUint32 negInfMask[2] = {0, TX_DOUBLE_HI32_EXPMASK | TX_DOUBLE_HI32_SIGNBIT};
+ */
+
+ /* alignment needs to be to 'double' datatype */
+ union {
+ const PRUint32 nanMask[2];
+ double dummy;
+ } un_nanMask = { {0xffffffff, TX_DOUBLE_HI32_EXPMASK | TX_DOUBLE_HI32_MANTMASK} };
+ #define nanMask (un_nanMask.nanMask)
+
+ union {
+ const PRUint32 infMask[2];
+ double dummy;
+ } un_infMask = { {0, TX_DOUBLE_HI32_EXPMASK} };
+ #define infMask (un_infMask.infMask)
+
+ union {
+ const PRUint32 negInfMask[2];
+ double dummy;
+ } un_negInfMask = { {0, TX_DOUBLE_HI32_EXPMASK | TX_DOUBLE_HI32_SIGNBIT} };
+ #define negInfMask (un_negInfMask.negInfMask)
#endif
const double Double::NaN = *((double*)nanMask);
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: pkg-manager->solaris-pkg-people
Responsible-Changed-By: wiz@netbsd.org
Responsible-Changed-When: Mon, 02 May 2005 13:32:18 +0000
Responsible-Changed-Why:
Solaris pkgsrc problem (I think).
Responsible-Changed-From-To: solaris-pkg-people->taya
Responsible-Changed-By: wiz@netbsd.org
Responsible-Changed-When: Mon, 02 May 2005 14:24:10 +0000
Responsible-Changed-Why:
Not Solaris-specific -- over to maintainer.
From: segv <segv@netctl.net>
To: wiz@netbsd.org
Cc: solaris-pkg-people@netbsd.org, pkg-manager@netbsd.org,
pkgsrc-bugs@netbsd.org, gnats-admin@netbsd.org, wiz@netbsd.org
Subject: Re: pkg/30106
Date: Mon, 2 May 2005 15:15:52 +0100
On Mon, 2 May 2005 13:32:19 +0000 (UTC)
wiz@netbsd.org wrote:
> Synopsis: www/firefox failes to install with 'Bus error' on UltraSparc machines
>
> Responsible-Changed-From-To: pkg-manager->solaris-pkg-people
> Responsible-Changed-By: wiz@netbsd.org
> Responsible-Changed-When: Mon, 02 May 2005 13:32:18 +0000
> Responsible-Changed-Why:
> Solaris pkgsrc problem (I think).
>
>
>
It's not just Solaris problem, it's a 64-bit issue which will bite on 64-bit platforms like UltraSparc, not matter which OS is installed
From: "Shin'ichiro TAYA" <taya@ba2.so-net.ne.jp>
To: gnats-bugs@netbsd.org
Cc: taya@netbsd.org, gnats-admin@netbsd.org, pkgsrc-bugs@netbsd.org,
martin@netbsd.org
Subject: Re: pkg/30106
Date: Sat, 07 May 2005 18:40:37 +0900
This is a multi-part message in MIME format.
--------------020009060005080700080002
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
segv wrote:
> It's not just Solaris problem, it's a 64-bit issue which will bite on 64-bit platforms like UltraSparc, not matter which OS is installed
I think source code itself has problem.
I tested this problem with attached source code on sparc64.
Simply compiled code has problem you mentioned.
But shared object created from this source code doesn't dump core.
I don't have much knowledge about toolchain nor sparc asm lang.
I don't known whether data is properly aligned or unaligned access is
prevented. Anyway I never see this problem with alpha, amd64,
sparc64(all NetBSD). And there is a official distribution for Solaris.
I wonder this patch is really required or not....
--------------020009060005080700080002
Content-Type: text/plain; x-mac-type="0"; x-mac-creator="0";
name="doubletest.cpp"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="doubletest.cpp"
#include <inttypes.h>
#define TX_DOUBLE_HI32_SIGNBIT 0x80000000
#define TX_DOUBLE_HI32_EXPMASK 0x7ff00000
#define TX_DOUBLE_HI32_MANTMASK 0x000fffff
typedef uint32_t PRUint32;
//-- Initialize Double related constants
#ifdef IS_BIG_ENDIAN
const PRUint32 nanMask[2] = {TX_DOUBLE_HI32_EXPMASK | TX_DOUBLE_HI32_MANTMASK
,
0xffffffff};
const PRUint32 infMask[2] = {TX_DOUBLE_HI32_EXPMASK, 0};
const PRUint32 negInfMask[2] = {TX_DOUBLE_HI32_EXPMASK | TX_DOUBLE_HI32_SIGNBIT,
0};
#else
const PRUint32 nanMask[2] = {0xffffffff,
TX_DOUBLE_HI32_EXPMASK | TX_DOUBLE_HI32_MANTMASK
};
const PRUint32 infMask[2] = {0, TX_DOUBLE_HI32_EXPMASK};
const PRUint32 negInfMask[2] = {0, TX_DOUBLE_HI32_EXPMASK | TX_DOUBLE_HI32_SIGNBIT};
#endif
const double NaN = *((double*)nanMask);
const double POSITIVE_INFINITY = *((double*)infMask);
const double NEGATIVE_INFINITY = *((double*)negInfMask);
double
get_double()
{
return NaN;
}
#if 0
main()
{
printf("%f", get_double());
}
#endif
--------------020009060005080700080002--
From: Martin Husemann <martin@duskware.de>
To: Shin'ichiro TAYA <taya@ba2.so-net.ne.jp>
Cc: gnats-bugs@netbsd.org, taya@netbsd.org
Subject: Re: pkg/30106
Date: Sat, 7 May 2005 16:08:15 +0200
On Sat, May 07, 2005 at 06:40:37PM +0900, Shin'ichiro TAYA wrote:
> const PRUint32 nanMask[2] = {TX_DOUBLE_HI32_EXPMASK | TX_DOUBLE_HI32_MANTMASK
> const double NaN = *((double*)nanMask);
This code may work by luck, but it is not guaranteed to work. The compiler
will guarantee that the variable nanMask is properly aligned on a 32bit
address, but the double* dereference needs to be aligned on a 64bit address
(speaking of sparc64 systems here).
So depending on declarations of other variables and link order, you will
get working or broken object code.
Now what to do? I think a real fix would be to use HUGE_VAL and NAN from
<math.h> instead of the homegrown constants - if available. The header
refers to ANSI/ISO C standard sections, so I suppose many systems nowadays
will support these constants, and the NSPR maintainers probably will hapilly
accept a change like this.
Martin
From: Martin Husemann <martin@netbsd.org>
To: gnats-bugs@netbsd.org
Cc:
Subject: PR/30106 CVS commit: pkgsrc/www/mozilla
Date: Tue, 31 May 2005 09:21:51 +0000 (UTC)
Module Name: pkgsrc
Committed By: martin
Date: Tue May 31 09:21:51 UTC 2005
Modified Files:
pkgsrc/www/mozilla: distinfo
Added Files:
pkgsrc/www/mozilla/patches: patch-cd
Log Message:
Replace the homegrown floating point binary access patterns in class Double
by macros from math.h to avoid alignement problems described in
PR pkg/30106.
To generate a diff of this commit:
cvs rdiff -r1.76 -r1.77 pkgsrc/www/mozilla/distinfo
cvs rdiff -r0 -r1.1 pkgsrc/www/mozilla/patches/patch-cd
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: Martin Husemann <martin@netbsd.org>
To: gnats-bugs@netbsd.org
Cc:
Subject: PR/30106 CVS commit: pkgsrc/www/firefox
Date: Thu, 2 Jun 2005 12:37:34 +0000 (UTC)
Module Name: pkgsrc
Committed By: martin
Date: Thu Jun 2 12:37:33 UTC 2005
Modified Files:
pkgsrc/www/firefox: distinfo
Added Files:
pkgsrc/www/firefox/patches: patch-cg
Log Message:
Replace the homegrown floating point binary access patterns in class Double
by macros from math.h to avoid alignement problems described in
PR pkg/30106.
(Same as ../mozilla/patches/patch-cd)
To generate a diff of this commit:
cvs rdiff -r1.29 -r1.30 pkgsrc/www/firefox/distinfo
cvs rdiff -r0 -r1.1 pkgsrc/www/firefox/patches/patch-cg
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: open->feedback
State-Changed-By: wiz@netbsd.org
State-Changed-When: Sat, 07 Oct 2006 19:07:58 +0000
State-Changed-Why:
A fix has been committed, do you still see the problem?
State-Changed-From-To: feedback->closed
State-Changed-By: wiz@netbsd.org
State-Changed-When: Thu, 12 Oct 2006 22:53:26 +0000
State-Changed-Why:
Connection timed out.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.