gentoo-hardened, mknbi doesn't emerge, ld ends up with many errors: undefinded reference to `__guard' and undefined reference to `__stack_smash_handler' Reproducible: Always Steps to Reproduce: 1.emerge mknbi 2. 3. Actual Results: emerge mknbi Calculating dependencies ...done! >>> emerge (1 of 1) net-misc/mknbi-1.4.3 to / >>> md5 src_uri ;-) mknbi-1.4.3.tar.gz >>> Unpacking source... >>> Unpacking mknbi-1.4.3.tar.gz to /var/tmp/portage/mknbi-1.4.3/work >>> Source unpacked. (...) pod2man --date=`date +%Y-%m-%d` --release="Mknbi 1.4.3" --center="Etherboot tools" menuc.pl > menuc.1 ld -N -Ttext 0x92800 -e _start --oformat binary -o first32@0x92800.linux start32@0x92800.o first32.o memsizes.o printf.o pod2man --date=`date +%Y-%m-%d` --release="Mknbi 1.4.3" --center="Etherboot tools" disnbi.pl > disnbi.1 first32.o(.text+0xe): In function `putchar': : undefined reference to `_GLOBAL_OFFSET_TABLE_' first32.o(.text+0x18): In function `putchar': : undefined reference to `__guard' first32.o(.text+0x47): In function `putchar': : undefined reference to `__stack_smash_handler' first32.o(.text+0x61): In function `nomem': : undefined reference to `_GLOBAL_OFFSET_TABLE_' first32.o(.text+0x67): In function `nomem': : undefined reference to `__guard' first32.o(.text+0x97): In function `nomem': : undefined reference to `__stack_smash_handler' first32.o(.text+0xb0): In function `gettag': : undefined reference to `_GLOBAL_OFFSET_TABLE_' first32.o(.text+0xb6): In function `gettag': : undefined reference to `__guard' first32.o(.text+0x114): In function `gettag': : undefined reference to `__stack_smash_handler' first32.o(.text+0x12e): In function `outtag': : undefined reference to `_GLOBAL_OFFSET_TABLE_' first32.o(.text+0x134): In function `outtag': : undefined reference to `__guard' first32.o(.text+0x17e): In function `outtag': : undefined reference to `__guard' first32.o(.text+0x191): In function `outtag': : undefined reference to `__stack_smash_handler' first32.o(.text+0x1ab): In function `strprefix': : undefined reference to `_GLOBAL_OFFSET_TABLE_' first32.o(.text+0x1b1): In function `strprefix': : undefined reference to `__guard' first32.o(.text+0x1f7): In function `strprefix': : undefined reference to `__stack_smash_handler' first32.o(.text+0x211): In function `gethex': : undefined reference to `_GLOBAL_OFFSET_TABLE_' first32.o(.text+0x217): In function `gethex': : undefined reference to `__guard' first32.o(.text+0x269): In function `gethex': : undefined reference to `__stack_smash_handler' first32.o(.text+0x284): In function `getdec': : undefined reference to `_GLOBAL_OFFSET_TABLE_' first32.o(.text+0x28a): In function `getdec': : undefined reference to `__guard' first32.o(.text+0x2d3): In function `getdec': : undefined reference to `__stack_smash_handler' first32.o(.text+0x2ec): In function `copy_nonws': : undefined reference to `_GLOBAL_OFFSET_TABLE_' first32.o(.text+0x2f2): In function `copy_nonws': : undefined reference to `__guard' first32.o(.text+0x354): In function `copy_nonws': : undefined reference to `__stack_smash_handler' first32.o(.text+0x36b): In function `discard_arg': : undefined reference to `_GLOBAL_OFFSET_TABLE_' first32.o(.text+0x371): In function `discard_arg': : undefined reference to `__guard' first32.o(.text+0x3c0): In function `discard_arg': : undefined reference to `__stack_smash_handler' first32.o(.text+0x3da): In function `outip': : undefined reference to `_GLOBAL_OFFSET_TABLE_' first32.o(.text+0x3e0): In function `outip': : undefined reference to `__guard' first32.o(.text+0x521): In function `.L86': : undefined reference to `__guard' first32.o(.text+0x535): In function `.L86': : undefined reference to `__stack_smash_handler' first32.o(.text+0x552): In function `parse_elf_boot_notes': : undefined reference to `_GLOBAL_OFFSET_TABLE_' first32.o(.text+0x558): In function `parse_elf_boot_notes': : undefined reference to `__guard' first32.o(.text+0x63a): In function `parse_elf_boot_notes': : undefined reference to `__stack_smash_handler' first32.o(.text+0x657): In function `first': : undefined reference to `_GLOBAL_OFFSET_TABLE_' first32.o(.text+0x65d): In function `first': : undefined reference to `__guard' first32.o(.text+0xdf7): In function `.L202': : undefined reference to `__guard' first32.o(.text+0xe0d): In function `.L202': : undefined reference to `__stack_smash_handler' first32.o(.text+0xe28): In function `subst_value': : undefined reference to `_GLOBAL_OFFSET_TABLE_' first32.o(.text+0xe32): In function `subst_value': : undefined reference to `__guard' first32.o(.text+0x10f2): In function `subst_value': : undefined reference to `__guard' first32.o(.text+0x1105): In function `subst_value': : undefined reference to `__stack_smash_handler' memsizes.o(.text+0xe): In function `get_memsizes': : undefined reference to `_GLOBAL_OFFSET_TABLE_' memsizes.o(.text+0x14): In function `get_memsizes': : undefined reference to `__guard' memsizes.o(.text+0x99): In function `get_memsizes': : undefined reference to `__stack_smash_handler' printf.o(.text+0xf): In function `vsprintf': : undefined reference to `_GLOBAL_OFFSET_TABLE_' printf.o(.text+0x15): In function `vsprintf': : undefined reference to `__guard' printf.o(.text+0x282): In function `vsprintf': : undefined reference to `__guard' printf.o(.text+0x29a): In function `vsprintf': : undefined reference to `__stack_smash_handler' printf.o(.text+0x2b5): In function `sprintf': : undefined reference to `_GLOBAL_OFFSET_TABLE_' printf.o(.text+0x2bb): In function `sprintf': : undefined reference to `__guard' printf.o(.text+0x2eb): In function `sprintf': : undefined reference to `__stack_smash_handler' printf.o(.text+0x304): In function `printf': : undefined reference to `_GLOBAL_OFFSET_TABLE_' printf.o(.text+0x30a): In function `printf': : undefined reference to `__guard' printf.o(.text+0x338): In function `printf': : undefined reference to `__stack_smash_handler' make: *** [first32@0x92800.linux] Błąd 1 make: *** Czekam na niezakończone zadania.... pod2man --date=`date +%Y-%m-%d` --release="Mknbi 1.4.3" --center="Etherboot tools" menuc.pl > menuc.1 make: *** Czekam na niezakończone zadania.... rm start32@0x82800.o start32@0x92800.o !!! ERROR: net-misc/mknbi-1.4.3 failed. Expected Results: correct emerge emerge --info Portage 2.0.51.19 (hardened/x86, gcc-3.3.5, glibc-2.3.4.20040808-r1, 2.6.10-grsec i686) ================================================================= System uname: 2.6.10-grsec i686 Pentium III (Coppermine) Gentoo Base System version 1.4.16 Python: dev-lang/python-2.3.4-r1 [2.3.4 (#1, Feb 11 2005,12:07:53)] dev-lang/python: 2.3.4-r1 sys-devel/autoconf: 2.59-r6, 2.13 sys-devel/automake: 1.5, 1.8.5-r3, 1.6.3, 1.7.9-r1, 1.4_p6, 1.9.4 sys-devel/binutils: 2.15.92.0.2-r1 sys-devel/libtool: 1.5.10-r4 virtual/os-headers: 2.4.22-r1 ACCEPT_KEYWORDS="x86" AUTOCLEAN="yes" CFLAGS="-O2 -march=pentium3 -fomit-frame-pointer" CHOST="i686-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config /usr/lib/X11/xkb /usr/share/config /var/qmail/control" CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d" CXXFLAGS="-O2 -march=pentium3 -fomit-frame-pointer" DISTDIR="/usr/portage/distfiles" FEATURES="autoaddcvs autoconfig ccache distlocks sandbox" GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/Linux/distributions/gentoo" LANG="pl_PL" MAKEOPTS="-j2" PKGDIR="/usr/portage//packages/x86/" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage/" SYNC="rsync://rsync.gentoo.org/gentoo-portage" USE="X aalib acpi adns alsa apache2 apm avi berkdb bitmap-fonts cdr crypt cups dhcp directfb divx4linux dlloader dvd dvdread esd fbcon ftp ggi gif gpm gtk gtk2 hardened imlib ipv6 jpeg libwww mad mmx mpeg mysql ncurses nls oggvorbis opengl oss pam pdflib perl pic pie png python quicktime readline samba slang snmp spell sse ssl svga tcpd threads tiff truetype truetype-fonts type1-fonts userlocales x86 xinerama xml2 xmms xv xvid zlib" Unset: ASFLAGS, CBUILD, CTARGET, LC_ALL, LDFLAGS, PORTDIR_OVERLAY
Created attachment 56517 [details, diff] mknbi-1.4.3-nossp.patch Attached patch disables ssp and pie all together for this type of ebuild.
Created attachment 56519 [details, diff] mknbi-1.4.3.ebuild.diff diff to ebuild.
updates are in the portage tree now.
Yes, I did these corrections to CFLAGS already before - by hand, and compiled package without SSP and PIE. But I wouldn't like to disable SSP and PIE, rather improve the package to compile with these extensions. And, shouldn't it be rather set by USE keywords (-ssp, -pie, -hardened....) ? However, at least it works ;) greetings!
this package uses aboslute addressing mode and must be loaded at a fixed localtion to that throws away the idea of pie. As far as ssp goes it's not really worth it to halt execution of it (this is to low level.. just like bootloaders).