Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 30359 - proftpd doesn't compile with hardened-gcc (using -yet_exec )
Summary: proftpd doesn't compile with hardened-gcc (using -yet_exec )
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: The Gentoo Linux Hardened Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-10-04 19:37 UTC by Nick Fish
Modified: 2003-10-05 08:32 UTC (History)
0 users

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


Attachments
patch (proftpd-etdyn.patch,614 bytes, patch)
2003-10-04 19:37 UTC, Nick Fish
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Fish 2003-10-04 19:37:09 UTC
Compiling proftpd with hardened-gcc yields:

gcc -march=pentium4 -O3 -pipe -fforce-addr -foptimize-sibling-calls -fno-inline -finline-limit=1000 -Wall -c cap_sys.c -o cap_sys.o
cap_sys.c: In function `capget':
cap_sys.c:14: error: can't find a register in class `BREG' while reloading `asm'
make[1]: *** [cap_sys.o] Error 1
make[1]: Leaving directory `/var/tmp/portage/proftpd-1.2.9_rc2/work/proftpd-1.2.9rc2/lib/libcap'
make: *** [dirs] Error 2


attached is a patch to avoid using -yet_exec to compile proftpd.  Thanks to the guys in #gentoo-hardened for helping me figure this out.
Comment 1 Nick Fish 2003-10-04 19:37:32 UTC
Created attachment 18767 [details, diff]
patch
Comment 2 Alexander Gabert (RETIRED) gentoo-dev 2003-10-05 06:21:48 UTC
fixed in cvs, added -yet_exec to fix configure and later sed it out again

Alex
Comment 3 solar (RETIRED) gentoo-dev 2003-10-05 07:54:30 UTC
Reeversing the previous commit.

The reason this happens with proftpd is it includes its own bundled libcap
which is not a position independent safe version. pic code uses reserves
the ebx register and the ebx gets munched by the glibc version of _syscall2()
so the two are not really compatible. 

More info on the bundled version of libcap with proftpd can be found in proftpd's
bugzilla. http://bugs.proftpd.org/show_bug.cgi?id=2000

Using modern glibc with we can get the true desired result with.

has_version sys-devel/hardened-gcc && echo > lib/libcap/cap_sys.c

solar@simple proftpd $ file `which proftpd`
/usr/sbin/proftpd: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV),
stripped
Comment 4 solar (RETIRED) gentoo-dev 2003-10-05 08:32:04 UTC
merged second fix in cvs. 
This fix also allows users that have -fPIC in C[XX]FLAGS to also compile
proftpd without getting the exact same BREG errors (such as prelink users)