From nobody@FreeBSD.org  Sun Jan 30 23:27:38 2005
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 3DB6716A4CE
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 30 Jan 2005 23:27:38 +0000 (GMT)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 181CF43D1F
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 30 Jan 2005 23:27:38 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id j0UNRbRn067316
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 30 Jan 2005 23:27:37 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id j0UNRbZV067314;
	Sun, 30 Jan 2005 23:27:37 GMT
	(envelope-from nobody)
Message-Id: <200501302327.j0UNRbZV067314@www.freebsd.org>
Date: Sun, 30 Jan 2005 23:27:37 GMT
From: Thomas Melzer <tmelzer@tomesoft.de>
To: freebsd-gnats-submit@FreeBSD.org
Subject: security/cryptopp crashes if build with default optimization -O
X-Send-Pr-Version: www-2.3

>Number:         76875
>Category:       ports
>Synopsis:       security/cryptopp crashes if build with default optimization -O
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jan 30 23:30:23 GMT 2005
>Closed-Date:    Sun Jun 12 07:34:00 GMT 2005
>Last-Modified:  Sun Jun 12 07:34:00 GMT 2005
>Originator:     Thomas Melzer
>Release:        FreeBSD 5.3-RELEASE-p5 i386
>Organization:
Thomas Melzer Softwareentwicklung
>Environment:
FreeBSD terra.ddns.tomesoft.de 5.3-RELEASE-p5 FreeBSD 5.3-RELEASE-p5 #0: Thu Jan 27 20:31:57 CET 2005     root@terra.ddns.tomesoft.de:/usr/obj/usr/src/sys/GENERIC  i386
>Description:
Building security/cryptopp with the default compile options yields to 
to a build with 'g++ -O -pipe -march=pentium -fPIC -msse2 -pipe'.
Option -O optimizes for speed and size. This produces incorrect code with some encryption algoritmns and yield to crashes.

>How-To-Repeat:
- build port
- run cryptest v
cryptes crashes with core dump after executing 
'BlumBlumShub validation suite running...' test
>Fix:
add the following patch (which supresses optimization) to the port and all tests succeed

--- Makefile.orig       Sun Jan 30 14:05:17 2005
+++ Makefile    Mon Jan 31 00:24:57 2005
@@ -25,7 +25,7 @@
 EXTRACT_BEFORE_ARGS=   -aq
 USE_GMAKE=             yes
 MAKEFILE=              GNUmakefile
-CXXFLAGS+=             -fPIC
+CXXFLAGS+=             -fPIC -O0

 .include <bsd.port.pre.mk>

>Release-Note:
>Audit-Trail:

From: Xin LI <delphij@delphij.net>
To: freebsd-gnats-submit@FreeBSD.org
Cc:  
Subject: Re: ports/76875: security/cryptopp crashes if build with default
	optimization -O
Date: Tue, 01 Feb 2005 10:24:08 +0800

 --=-Us72KePwy5yHqrk22LWU
 Content-Type: text/plain; charset=UTF-8
 Content-Transfer-Encoding: quoted-printable
 
 Someone please commit this patch, thanks!
 
 =E5=9C=A8 2005-01-30=E6=97=A5=E7=9A=84 23:27 +0000=EF=BC=8CThomas Melzer=E5=
 =86=99=E9=81=93=EF=BC=9A
 > add the following patch (which supresses optimization) to the port and al=
 l tests succeed
 >=20
 > --- Makefile.orig       Sun Jan 30 14:05:17 2005
 > +++ Makefile    Mon Jan 31 00:24:57 2005
 > @@ -25,7 +25,7 @@
 >  EXTRACT_BEFORE_ARGS=3D   -aq
 >  USE_GMAKE=3D             yes
 >  MAKEFILE=3D              GNUmakefile
 > -CXXFLAGS+=3D             -fPIC
 > +CXXFLAGS+=3D             -fPIC -O0
 >=20
 >  .include <bsd.port.pre.mk>
 
 Cheers,
 --=20
 Xin LI <delphij delphij net>  http://www.delphij.net/
 
 --=-Us72KePwy5yHqrk22LWU
 Content-Type: application/pgp-signature; name=signature.asc
 Content-Description:
 	=?UTF-8?Q?=E8=BF=99=E6=98=AF=E4=BF=A1=E4=BB=B6=E7=9A=84=E6=95=B0?=
 	=?UTF-8?Q?=E5=AD=97=E7=AD=BE=E5=90=8D=E9=83=A8?= =?UTF-8?Q?=E5=88=86?=
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.0 (FreeBSD)
 
 iD8DBQBB/uhH/cVsHxFZiIoRAvR0AJ9RyasSnUbSCMfvzDvPkvgML9TwJACgg6rm
 +jfTBXOpUWTfoAfWk+rdYT8=
 =6VMb
 -----END PGP SIGNATURE-----
 
 --=-Us72KePwy5yHqrk22LWU--
 

From: Pav Lucistnik <pav@FreeBSD.org>
To: freebsd-gnats-submit@FreeBSD.org
Cc:  
Subject: Re: ports/76875: security/cryptopp crashes if build with default
	optimization -O
Date: Tue, 01 Feb 2005 10:08:35 +0100

 Works fine for me.
 
 Your output seems to contain -march=pentium which mine system don't emit
 -- can you check without it? I think it's not there by default.
 
 -- 
 Pav Lucistnik <pav@oook.cz>
               <pav@FreeBSD.org>
 
 Bento's Law: If It Can Break, It Will Break
 Bento's Corollary: If It Can Break, Kris Can Send Mail About It

From: Thomas Melzer <TMelzer@bineo.de>
To: freebsd-gnats-submit@FreeBSD.org, tmelzer@tomesoft.de
Cc:  
Subject: Re: ports/76875: security/cryptopp crashes if build with default 
	optimization -O
Date: Tue, 1 Feb 2005 13:51:07 +0100 

 I've tested the build by supressing the -march=pentium switch. 
 The port build emits the same behaviour. Build with -O crash, build with -O0
 cryptest runs fine.
 
 Further investigation have shown where the compileswitches -O and
 -march=pentium 
 come from. In my /etc/make.conf i have the following 2 lines 
 
 CPUTYPE=i586
 CFLAGS= -O -pipe
 
 I use CPUTYPE=i586 because my build machine is a Pentium4 2.8 GHz machine
 and 
 Several of my older servers have only pentium cpus. This line lead to
 -march=pentium option.
 CFLAGS is the supported maximum for buildworld and kernel.
 
 If i comment out these settings cryptopp port is compiled with
 
 -fPIC -msse2 -pipe
 
 Cryptest runs as expected. But if you use the CFLAGS setting above 
 You have to apply my patch as cryptest breaks.
 
 So I think the save way will be to disable optimization explicit so
 that optimazation settings in make.conf can not break the port.
 
 Regards
 -- Thomas
 
 
 
State-Changed-From-To: open->closed 
State-Changed-By: pat 
State-Changed-When: Sun Jun 12 07:33:44 GMT 2005 
State-Changed-Why:  
Committed, Thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=76875 
>Unformatted:
