Bug 437331

Summary: OpenJDK doesn't honour optflags
Product: [Fedora] Fedora Reporter: Lubomir Kundrak <lkundrak>
Component: java-1.6.0-openjdkAssignee: Thomas Fitzsimmons <fitzsim>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: high    
Version: rawhideCC: gbenson, langel
Target Milestone: ---Keywords: Reopened, Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-03-20 18:34:35 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Build output with flags set
none
Output with stderr redirected. none

Description Lubomir Kundrak 2008-03-13 16:08:58 UTC
Description of problem:

According to the packaging guidelines, all packages must pass predefined
%{_optflags} to C and C++ compiler. Not doing so has various security,
performance and compatibility implications.

OpenJDK ignores those.

Version-Release number of selected component (if applicable):

java-1.6.0-openjdk-1.6.0.0-0.2.b06.fc9

Comment 1 Thomas Fitzsimmons 2008-03-13 16:22:19 UTC
Gary, do you foresee zero having any problems with these flags?

-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
--param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic
-fasynchronous-unwind-tables


Comment 2 Lillian Angel 2008-03-13 18:09:13 UTC
I am not successful in building java-1.6.0-openjdk with those CFLAGS and
CPPFLAGS set.

Comment 3 Lillian Angel 2008-03-13 18:19:24 UTC
Created attachment 297963 [details]
Build output with flags set

Built like so:
./configure --with-openjdk && make CFLAGS="-O2 -g -pipe -Wall
-Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
--param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic
-fasynchronous-unwind-tables" CPPFLAGS="-O2 -g -pipe -Wall
-Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
--param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic
-fasynchronous-unwind-tables"

Comment 4 Lillian Angel 2008-03-13 18:22:57 UTC
Created attachment 297965 [details]
Output with stderr redirected.

Comment 5 Lillian Angel 2008-03-13 18:32:03 UTC
This does work if we pass the CFLAGS to ./configure instead. I am testing builds
on x86_64 and x86.



Comment 6 Gary Benson 2008-03-14 09:40:12 UTC
I can't see it being a problem.  zero passes only -m{31,32,64} at the moment,
but I was wondering if I ought to be passing any -mtune options so that solves
that :)

Comment 7 Lillian Angel 2008-03-14 13:49:06 UTC
I have a patch to fix this. Once I complete a bit of smoke testing, I will
commit the changes to the spec file and rebuild java-1.6.0-openjdk.

Comment 8 Lillian Angel 2008-03-19 17:48:30 UTC
After testing out this fix, I noticed that ant is now broken. I have not built
this into rawhide yet.

Exception in thread "main" java.lang.NoClassDefFoundError:
org/apache/tools/ant/launch/Launcher
Caused by: java.lang.ClassNotFoundException: org.apache.tools.ant.launch.Launcher
        at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:323)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:336)


Comment 9 Lillian Angel 2008-03-20 18:34:35 UTC
Finally fixed. Building into rawhide now.