Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 406119 - kde-misc/kdiff3-0.9.96 fails to build (pch's, address space randomization?)
Summary: kde-misc/kdiff3-0.9.96 fails to build (pch's, address space randomization?)
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] KDE (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo KDE team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-28 09:05 UTC by Märt Bakhoff
Modified: 2012-05-02 10:09 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge --info (emerge_info.log,4.48 KB, text/plain)
2012-02-28 09:05 UTC, Märt Bakhoff
Details
build.log (build.log,2.38 KB, text/plain)
2012-02-29 07:35 UTC, Märt Bakhoff
Details
successful build.log (build.log,25.63 KB, text/plain)
2012-02-29 15:37 UTC, Chris Reffett (RETIRED)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Märt Bakhoff 2012-02-28 09:05:03 UTC
Created attachment 303567 [details]
emerge --info

Build fails on amd64 hardened: 

x86_64-pc-linux-gnu-g++ -c -include kdiff3 -pipe -O2 -pipe -march=native -mtune=native -D_REENTRANT -Wall -W -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -Isrc-QT4 -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -Isrc-QT4 -Isrc-QT4/kreplacements -I. -I. -o main.o src-QT4/main.cpp
cc1plus: error: one or more PCH files were found, but they were invalid
cc1plus: error: use -Winvalid-pch for more information
cc1plus: fatal error: kdiff3: No such file or directory
compilation terminated.

Any ideas?
Comment 1 Chris Reffett (RETIRED) gentoo-dev Security 2012-02-29 02:26:40 UTC
Could not confirm on amd64 non-hardened. Please attach full build.log.
Comment 2 Märt Bakhoff 2012-02-29 07:35:24 UTC
Created attachment 303691 [details]
build.log

build.log: There not much new there.. 

Could the suggested -Winvalid-pch flag help? How can I enable it?
Comment 3 Chris Reffett (RETIRED) gentoo-dev Security 2012-02-29 15:37:47 UTC
Created attachment 303745 [details]
successful build.log

I'm thinking the error is earlier--almost nothing happens in your configure phase, just "Running qmake", whereas when I emerge kdiff3 it runs a bunch of normal KDE configuration checks. I've attached the build.log from my successful emerge for comparison.
Comment 4 Märt Bakhoff 2012-02-29 22:18:58 UTC
figured it out. -Winvalid-pch gave me:

g++ -c -include kdiff3 -pipe -O2 -Winvalid-pch -D_REENTRANT -Wall -W -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -Isrc-QT4 -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -Isrc-QT4 -Isrc-QT4/kreplacements -I. -I. -o main.o src-QT4/main.cpp
cc1plus: warning: ./kdiff3.gch/c++: had text segment at different address
cc1plus: warning: src-QT4/kdiff3.gch/c++: had text segment at different address
cc1plus: error: one or more PCH files were found, but they were invalid
cc1plus: fatal error: kdiff3: No such file or directory

related bug: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39206

pax address-space randomization somehow messes up PCH files. 
workaround is "echo 0 > /proc/sys/kernel/randomize_va_space" before compiling. the program itself works fine with address-space randomization enabled.
Comment 5 Michael Palimaka (kensington) gentoo-dev 2012-03-12 15:13:04 UTC
That's strange, I'm unable to reproduce with amd64 hardened and randomize_va_space = 2.

Do you somehow have x11-libs/qt-core merged with USE="pch" by any chance?
Comment 6 Märt Bakhoff 2012-03-12 22:57:02 UTC
unlikely, the pch flag is masked

[ebuild   R    ] x11-libs/qt-core-4.8.0-r1  USE="exceptions glib iconv optimized-qmake qt3support ssl (-aqua) (-c++0x) -debug (-pch) (-qpa)" 0 kB
Comment 7 Andreas K. Hüttel archtester gentoo-dev 2012-05-01 17:47:31 UTC
Cc'ing hardened team for potential insights...
Comment 8 Magnus Granberg gentoo-dev 2012-05-01 20:37:34 UTC
Can you check what pax mark you have on cc1 and cc1plus?

laptop1 4.6.3 # paxctl -v cc1plus
PaX control v0.7
Copyright 2004,2005,2006,2007,2009,2010,2011,2012 PaX Team <pageexec@freemail.hu>

- PaX flags: -------x-e-r [cc1plus]
        RANDEXEC is disabled
        EMUTRAMP is disabled
        RANDMMAP is disabled

It compile fine for me.
* Updating shared mime info database ...
>>> kde-misc/kdiff3-0.9.96 merged.

laptop1 4.6.3 # emerge --info
Portage 2.1.10.57 (hardened/linux/amd64, gcc-4.6.3, glibc-2.14.1-r2, 3.3.0-hardened x86_64)
=================================================================
System uname: Linux-3.3.0-hardened-x86_64-Intel-R-_Core-TM-_i7_CPU_Q_720_@_1.60GHz-with-gentoo-2.1
Timestamp of tree: Tue, 01 May 2012 17:45:01 +0000
app-shells/bash:          4.2_p24
dev-java/java-config:     2.1.11-r3
dev-lang/python:          2.6.7-r2, 2.7.2-r3, 3.1.4-r3, 3.2.2-r1
dev-util/cmake:           2.8.7-r5
dev-util/pkgconfig:       0.26
sys-apps/baselayout:      2.1
sys-apps/openrc:          0.9.9.3
sys-apps/sandbox:         2.5
sys-devel/autoconf:       2.13, 2.68
sys-devel/automake:       1.8.5-r4, 1.9.6-r3, 1.11.4
sys-devel/binutils:       2.22-r1
sys-devel/gcc:            4.4.4-r2, 4.5.3-r2, 4.6.3, 4.7.0::hardened-dev
sys-devel/gcc-config:     1.6
sys-devel/libtool:        2.4.2
sys-devel/make:           3.82-r3
sys-kernel/linux-headers: 3.3 (virtual/os-headers)
sys-libs/glibc:           2.14.1-r2
CHOST="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -march=core2"
CXXFLAGS="-O2 -pipe -march=core2"
Comment 9 Märt Bakhoff 2012-05-02 08:19:43 UTC
Hi! Thanks for looking into this. 

I just tried to rebuild kdiff3 with pax enabled and it worked. I'm not sure what changed.. maybe an update fixed something. 


For the record:
mart@artemis /usr/libexec/gcc/x86_64-pc-linux-gnu/4.5.3 $ paxctl -v cc1
PaX control v0.7
Copyright 2004,2005,2006,2007,2009,2010,2011,2012 PaX Team <pageexec@freemail.hu>

- PaX flags: -------x-e-r [cc1]
	RANDEXEC is disabled
	EMUTRAMP is disabled
	RANDMMAP is disabled
mart@artemis /usr/libexec/gcc/x86_64-pc-linux-gnu/4.5.3 $ paxctl -v cc1plus 
PaX control v0.7
Copyright 2004,2005,2006,2007,2009,2010,2011,2012 PaX Team <pageexec@freemail.hu>

- PaX flags: -------x-e-r [cc1plus]
	RANDEXEC is disabled
	EMUTRAMP is disabled
	RANDMMAP is disabled
Comment 10 Anthony Basile gentoo-dev 2012-05-02 10:09:18 UTC
(In reply to comment #9)
> Hi! Thanks for looking into this. 
> 
> I just tried to rebuild kdiff3 with pax enabled and it worked. I'm not sure
> what changed.. maybe an update fixed something. 
> 
> 
> For the record:
> mart@artemis /usr/libexec/gcc/x86_64-pc-linux-gnu/4.5.3 $ paxctl -v cc1
> PaX control v0.7
> Copyright 2004,2005,2006,2007,2009,2010,2011,2012 PaX Team
> <pageexec@freemail.hu>
> 
> - PaX flags: -------x-e-r [cc1]
> 	RANDEXEC is disabled
> 	EMUTRAMP is disabled
> 	RANDMMAP is disabled
> mart@artemis /usr/libexec/gcc/x86_64-pc-linux-gnu/4.5.3 $ paxctl -v cc1plus 
> PaX control v0.7
> Copyright 2004,2005,2006,2007,2009,2010,2011,2012 PaX Team
> <pageexec@freemail.hu>
> 
> - PaX flags: -------x-e-r [cc1plus]
> 	RANDEXEC is disabled
> 	EMUTRAMP is disabled
> 	RANDMMAP is disabled

We only recently disabled RANDMMAP on cc1 and cc1plus.  With it on, you hit the bug, off and you avoid it.