Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 27507 - hardened gcc 3.2.3 fails to build module-init-tools or modutils
Summary: hardened gcc 3.2.3 fails to build module-init-tools or modutils
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Unspecified (show other bugs)
Hardware: x86 Linux
: High normal
Assignee: Alexander Gabert (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-08-28 18:24 UTC by Laurence Jupp
Modified: 2003-09-10 15:13 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Laurence Jupp 2003-08-28 18:24:34 UTC
I have set ACCEPT_KEYWORDS="~x86"

module-init-tools and modutils build fine after I do

hardened-gcc -R

but fail to build after I do

hardened-gcc -A

.
.
gcc -O3 -march=athlon-xp -pipe -fstack-protector -I./../include -D_GNU_SOURCE 
-DCONFIG_ROOT_CHECK_OFF=0  -DELF_MACHINE_H='"elf_i386.h"' -DARCH_i386  -c -o
sys_oim.o sys_oim.c
sys_oim.c: In function `old_sys_init_module':
sys_oim.c:38: can't find a register in class `BREG' while reloading `asm'
make[1]: *** [sys_oim.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory
`/var/tmp/portage/module-init-tools-0.9.13_pre2/work/modutils-2.4.25/util'
make: *** [all] Error 2

It seems to be the same with earlier versions of module-init-tools.

I've had a play with the code and found that if I left sys_oim.o out of the
library, nothing seemed to miss it.

Reproducible: Always
Steps to Reproduce:
1.emerge hardened-gcc
2.hardened-gcc -A
3.emerge module-init-tools

Actual Results:  
failed to compile, as described under 'details'

Expected Results:  
successful compilation

System uname: 2.6.0-test4 i686 AMD Athlon(tm) XP 1800+
ACCEPT_KEYWORDS="x86 ~x86"
AUTOCLEAN="yes"
CFLAGS="-O3 -march=athlon-xp -pipe -fstack-protector"
CHOST="i686-pc-linux-gnu"
COMPILER="gcc3"
CONFIG_PROTECT="/etc /var/qmail/control /usr/kde/2/share/config
/usr/kde/3/share/config /usr/X11R6/lib/X11/xkb /usr/kde/3.1/share/config
/usr/share/config"
CONFIG_PROTECT_MASK="/etc/gconf /etc/env.d"
CXXFLAGS="-O3 -march=athlon-xp -pipe -fstack-protector"
DISTDIR="/usr/portage/distfiles"
FEATURES="sandbox ccache autoaddcvs"
GENTOO_MIRRORS="ftp://cs.ubishops.ca/pub/gentoo
ftp://ftp.ucsb.edu/pub/mirrors/linux/gentoo/
ftp://mirror.iawnet.sandia.gov/pub/gentoo/"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY=""
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="x86 oss apm encode gnome libg++ mikmod xmms gdbm berkdb svga tcltk sdl
libwww esd imlib oggvorbis gtk 3dnow acpi alsa arts avi cdr crypt cups dga
directfb dvd foomaticdb gif gpm java jpeg kde kerberos ldap mbox mad mmx motif
mozilla mpeg mpi ncurses nls opengl pam pdflib perl png python qt quicktime
readline sasl slang spell sse ssl tcpd tetex tiff truetype usb wmf X xml xml2 xv
zlib"
Comment 1 Martin Schlemmer (RETIRED) gentoo-dev 2003-09-01 11:56:32 UTC
Please bump to the hardened team to fix this.
Comment 2 solar (RETIRED) gentoo-dev 2003-09-01 15:45:24 UTC
I think this is somewhat of a common problem for code that uses inline asm for system calls (util-linux had the suffered the problem before)

Note: 
The hardened-gcc has alot of logic built into that enables transparent -fstack-protector.
So you should be able to remove -fstack-protector

assigning bug to bug pappy@gentoo.org

pappy can you look into this and make module-init-tools and modutils -fPIC aware.
Comment 3 Alexander Gabert (RETIRED) gentoo-dev 2003-09-02 03:26:16 UTC
asm inline constructed syscalls (found in util-linux also) are prohibited by the transparent -fPIC in the specs file of hardened-gcc

same problem applies to util-linux where a PIC patch has been designed by solar and pappy

please do not CC azarah as he is a busy man and hardened-gcc is not his toy but mine.
Comment 4 Laurence Jupp 2003-09-03 14:52:09 UTC
There seems to be similar problems compiling libmpeg3

gcc -c `cat i686/c_flags`  video/slice.c -o i686/video/slice.o
/usr/include/stdlib.h: In function `mpeg3video_addblock':
video/slice.c:211: can't find a register in class `BREG' while reloading `asm'
make: *** [i686/video/slice.o] Error 1

!!! ERROR: media-libs/libmpeg3-1.5.1 failed.
!!! Function src_compile, Line 40, Exitcode 2
!!! (no error message)

and mplayer

gcc -O4 -march=athlon-xp -mcpu=athlon-xp -pipe -ffast-math -fomit-frame-pointer -D_REENTRANT -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Wall -g -DHAVE_AV_CONFIG_H -I.. -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE -c -o msmpeg4.o msmpeg4.c 
In file included from msmpeg4.c:2007:
wmv2.c: In function `wmv2_encode_end':
wmv2.c:98: warning: unused variable `w'
In file included from msmpeg4.c:2007:
wmv2.c: In function `wmv2_add_block':
wmv2.c:578: warning: unused variable `temp'
wmv2.c:579: warning: unused variable `i'
wmv2.c: In function `msmpeg4_pred_dc':
msmpeg4.c:703: can't find a register in class `BREG' while reloading `asm'
make[1]: *** [msmpeg4.o] Error 1
make[1]: Leaving directory `/var/tmp/portage/mplayer-0.91/work/MPlayer-0.91/libavcodec'
make: *** [libavcodec/libavcodec.a] Error 2

!!! ERROR: media-video/mplayer-0.91 failed.
!!! Function src_compile, Line 285, Exitcode 2
!!! Failed to build MPlayer!
Comment 5 solar (RETIRED) gentoo-dev 2003-09-05 22:00:26 UTC
This is still failing...
modutils is apart of the "system" in just about every profile in gentoo so I think a workaround needs to be put in place rather quickly.

pappy any luck with some workaround logic?
Comment 6 Alexander Gabert (RETIRED) gentoo-dev 2003-09-06 11:30:10 UTC
made the changes to the ebuilds, please test sunday night and report back, thanks, Alex
Comment 7 Alexander Gabert (RETIRED) gentoo-dev 2003-09-09 01:13:02 UTC
Laurence, could you close the bug after you verified the packages?

TIA,

Alex
Comment 8 Laurence Jupp 2003-09-09 10:44:45 UTC
Sorry for the delay. Unfortunately I can't verify the packages as I still can't build module-init-tools, but now for a different reason. emerge sync and emerge -Du world have upgraded gcc to 3.3.1, which may have caused the new problem. It is also somewhat odd in that the build does not always fail at the same point. Below shows it failing at lsmod, but sometimes it is insmod or modinfo, which is confusing me. Shall I close this bug anyway and do I need to file a new bug or is this new thing something silly I've done? 

gcc  -mcpu=athlon-xp -O3 -pipe -yet_exec -Wunused -Wall -Wcast-align   -o lsmod 
 lsmod.o  
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.1/libgcc.a(_stack_smash_handler.oS)(.text
+0xd9): In function `__stack_smash_handler':
/var/tmp/portage/gcc-3.3.1-r1/work/gcc-3.3.1/gcc/libgcc2.c:2050: undefined refer
ence to `sigfillset'
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.1/libgcc.a(_stack_smash_handler.oS)(.text
+0xe9):/var/tmp/portage/gcc-3.3.1-r1/work/gcc-3.3.1/gcc/libgcc2.c:2051: undefine
d reference to `sigdelset'
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.1/libgcc.a(_stack_smash_handler.oS)(.text
+0x12b):/var/tmp/portage/gcc-3.3.1-r1/work/gcc-3.3.1/gcc/libgcc2.c:2058: undefin
ed reference to `strncat'
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.1/libgcc.a(_stack_smash_handler.oS)(.text
+0x1b7):/var/tmp/portage/gcc-3.3.1-r1/work/gcc-3.3.1/gcc/libgcc2.c:2066: undefin
ed reference to `socket'
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.1/libgcc.a(_stack_smash_handler.oS)(.text
+0x1f2):/var/tmp/portage/gcc-3.3.1-r1/work/gcc-3.3.1/gcc/libgcc2.c:2072: undefin
ed reference to `strncpy'
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.1/libgcc.a(_stack_smash_handler.oS)(.text
+0x226):/var/tmp/portage/gcc-3.3.1-r1/work/gcc-3.3.1/gcc/libgcc2.c:2075: undefin
ed reference to `sendto'
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.1/libgcc.a(_stack_smash_handler.oS)(.text
+0x252):/var/tmp/portage/gcc-3.3.1-r1/work/gcc-3.3.1/gcc/libgcc2.c:2085: undefin
ed reference to `sigfillset'
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.1/libgcc.a(_stack_smash_handler.oS)(.text
+0x2ba):/var/tmp/portage/gcc-3.3.1-r1/work/gcc-3.3.1/gcc/libgcc2.c:2092: undefin
ed reference to `strncat'
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.1/libgcc.a(_stack_smash_handler.oS)(.text
+0x327):/var/tmp/portage/gcc-3.3.1-r1/work/gcc-3.3.1/gcc/libgcc2.c:2061: undefin
ed reference to `strncat'
collect2: ld returned 1 exit status
make: *** [insmod.static] Error 1
make: *** Waiting for unfinished jobs....

!!! ERROR: sys-apps/module-init-tools-0.9.13_pre2 failed.
!!! Function src_compile, Line 87, Exitcode 2
!!! emake module-init-tools failed
Comment 9 Alexander Gabert (RETIRED) gentoo-dev 2003-09-09 11:47:07 UTC
another one got hit by the gcc upgrade?

try to copy the `gcc-config -L`/libgcc*.so into /lib and run ldconfig
Comment 10 Laurence Jupp 2003-09-09 12:12:30 UTC
Doesn't seem to help, I'm afraid. I did suffer the problems mentioned in bug 28185, but had managed to sort that out. The current problem seems to be different. If it's only me that has this problem then I shall assume that I've done something odd to my system and will sort this out. I guess I should close this bug as the -yet_exec flag seems now to be present and I imagine this will solve the original problem.
Comment 11 Laurence Jupp 2003-09-09 16:03:14 UTC
I don't think I'm capable of closing the bug. Am I supposed to be able to do this? The 'Status' and 'Resolution' fields do not seem to allow editing. Sorry.
Comment 12 solar (RETIRED) gentoo-dev 2003-09-09 21:55:49 UTC
Laurence,

No only developers can close bugs. Alex (pappy) has to change the status to TEST-REQUEST,CLOSED or reassign the bug when he is ready.
Comment 13 Alexander Gabert (RETIRED) gentoo-dev 2003-09-10 13:57:16 UTC
i only have "Leave as new" and cannot "change the bug" to FIXED

someone ought to look at that i guess
Comment 14 solar (RETIRED) gentoo-dev 2003-09-10 15:13:12 UTC
changing resolution to FIXED