Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 76082 - (toolchain) genkernel-3.1.0d doesn't compile udev-039 on hardened
Summary: (toolchain) genkernel-3.1.0d doesn't compile udev-039 on hardened
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo Genkernel Maintainers
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks:
 
Reported: 2004-12-29 14:44 UTC by Mathias Gug
Modified: 2005-07-03 13:51 UTC (History)
2 users (show)

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


Attachments
This is genkernel log (genkernel.log.gz,14.50 KB, application/x-gzip)
2004-12-29 14:46 UTC, Mathias Gug
Details
add ssp stub to klibc (klibc-ssp.patch,24.90 KB, patch)
2005-02-01 14:24 UTC, Mathias Gug
Details | Diff
Update patch for ssp stub (klibc-ssp.patch,1.36 KB, patch)
2005-02-03 13:50 UTC, Mathias Gug
Details | Diff
Patch for udev-054.tar.bz2 in genkernel-3.1.6 (ssbstub-klic-0.199-gentoo.patch,1.36 KB, patch)
2005-06-12 16:50 UTC, Christopher Byrne
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mathias Gug 2004-12-29 14:44:26 UTC
When trying to run genkernel on a hardened system, genkernel is not able to compile udev.

Reproducible: Always
Steps to Reproduce:
1. Install hardened-dev-sources and hardened system
2. Compile a new kernel with genkernel

Make sure that genkernel binary cache is empty.

Actual Results:  
The is the end of the message :

libgcc/__udivmoddi4.o(.text+0xcc):libgcc/__udivmoddi4.c:32: undefined reference
to `__stack_smash_handler'
make[2]: *** [libc.so] Error 1
make[2]: Leaving directory `/var/tmp/genkernel/udev-039/klibc/klibc'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/var/tmp/genkernel/udev-039/klibc'
make: *** [/var/tmp/genkernel/udev-039/klibc/klibc/crt0.o] Error 2
* Gentoo Linux Genkernel; Version 3.1.0d
 
* ERROR: Failed to compile the "KERNEL_DIR=/usr/src/linux-2.6.7-hardened-r17/
USE_KLIBC=true USE_LOG=false DEBUG=false udevdir=/dev all etc/udev/udev.conf"
target...


Expected Results:  
udev should be compiled.

# emerge info
Portage 2.0.51-r3 (hardened/x86/2.6, gcc-3.3.4, glibc-2.3.4.20040808-r1,
2.6.9-gentoo-r1 i686)
=================================================================
System uname: 2.6.9-gentoo-r1 i686 Intel(R) Pentium(R) 4 CPU 2.40GHz
Gentoo Base System version 1.4.16
Autoconf: sys-devel/autoconf-2.59-r5
Automake: sys-devel/automake-1.8.5-r1
Binutils: sys-devel/binutils-2.15.90.0.1.1-r3
Headers:  sys-kernel/linux-headers-2.4.21-r1
Libtools: sys-devel/libtool-1.5.2-r7
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CFLAGS="-O2 -mcpu=i686 -pipe"
CHOST="i686-pc-linux-gnu"
COMPILER=""
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config
/usr/share/config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-O2 -mcpu=i686 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs autoconfig ccache distlocks sandbox"
GENTOO_MIRRORS="http://gentoo.mirrored.ca
http://www.ibiblio.org/pub/Linux/distributions/gentoo"
MAKEOPTS="-j2"
PKGDIR="/usr/portage//packages/x86/"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage/"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://lxmaster.cesart.local/gentoo-portage"
USE="berkdb crypt dlloader hardened ncurses nls pam perl pic pie python readline
ssl tcpd x86 zlib"
Comment 1 Mathias Gug 2004-12-29 14:46:26 UTC
Created attachment 47166 [details]
This is genkernel log

This is the genkernel log file.
Comment 2 solar (RETIRED) gentoo-dev 2005-01-13 10:45:31 UTC
this sounds like a dupe.
Comment 3 Mathias Gug 2005-01-21 13:23:24 UTC
I've investigated this issue a little bit. 

The problem is due to the fact that klibc does't build on a hardened system. klibc doesn't support ssp __guard and __stack_smash_handler functions.

This can be verified by trying to emerge udev with the static use flag set on a hardened system.

On the other hand, udev doesn't need to be compiled with ssp for an initrd (which is the case where klibc is needed).

So a fix could be to update genkernel to not compile udev with ssp if ssp is enabled.

Another fix could be to make klibc compile with ssp. See bug 73112#c19.
Comment 4 solar (RETIRED) gentoo-dev 2005-01-21 14:41:22 UTC
yep.. disable it. or add stubs. http://dev.gentoo.org/~solar/ssp/ssp_simple.c
Comment 5 Mathias Gug 2005-02-01 14:24:05 UTC
Created attachment 50177 [details, diff]
add ssp stub to klibc

This is a patch that add a stub to klibc so that udev compiles on a hardened
system.

You need to apply the patch in the udev tarball.

Thanks to this patch, I can compile udev on a hardened system, create an initrd
with genkernel, and boot the system with it.
Comment 6 solar (RETIRED) gentoo-dev 2005-02-02 09:00:09 UTC
I think your patch might include a little too much. (namely all the *.h files)
Comment 7 Mathias Gug 2005-02-02 09:07:30 UTC
The header files are needed for the compilation. Otherwise, the compilation fails due to the lack of some function definitions.

I've just copied the header files from /usr/include. May be all the content is not needed.
Comment 8 Mathias Gug 2005-02-03 13:50:58 UTC
Created attachment 50280 [details, diff]
Update patch for ssp stub

This is an updated patch that removes all header files. Udev is compiling and
my test servers reboot correctly.
Comment 9 Tim Yamin (RETIRED) gentoo-dev 2005-02-03 15:48:46 UTC
Latest SSP Patch looks good; CCing Greg so he can have a look at it too.
Comment 10 Greg Kroah-Hartman (RETIRED) gentoo-dev 2005-02-04 23:53:01 UTC
looks ok to me.
Comment 11 Richard Scott 2005-06-04 10:41:48 UTC
I get the same problem with genkernel v3.1.5, is this fixed yet?
Comment 12 Richard Scott 2005-06-04 10:42:26 UTC
sorry make that genkernel v3.1.6.
Comment 13 solar (RETIRED) gentoo-dev 2005-06-04 11:10:25 UTC
Reassinging bug. The Hardened is powerless to fix this.
Comment 14 Christopher Byrne 2005-06-12 16:50:00 UTC
Created attachment 61128 [details, diff]
Patch for udev-054.tar.bz2 in genkernel-3.1.6

This is a patch again the unpacked tarball
/usr/share/genkernel/pkg/udev-054.tar.bz2 for genkernel 3.1.6 that adds the SSP
stub for udev-054/klibc-0.199.
Comment 15 Christopher Byrne 2005-06-12 17:37:43 UTC
I also tested again genkernel-3.2.0_pre3 (with default settings - initramfs and
udev). The same patch as the one I posted for 3.1.6 works. 
Comment 16 Eric Edgar (RETIRED) gentoo-dev 2005-06-22 20:40:44 UTC
according to plasmaroo this is in cvs now.  You may need to clear you caches in 
order to make this take effect however.

Comment 17 Tim Yamin (RETIRED) gentoo-dev 2005-07-03 13:51:05 UTC
This is fixed in genkernel_pre10 and up, closing bug as fixed; reopen if you
have issues.