Post by Bela LubkinSteven>>> On your Gentoo i3... am I right in thinking you have a hardened/PaX
Steven>>> build environment?
Jorge>> Nope. It's a standard profile, no fancy
Jorge>> stuff whatsoever (box is used to backups and compiling some stuff,
Jorge>> used mainly via ssh, not even X installed)
Steven> Oh well, worth a guess! I just noticed this strange program header
Steven> entry (only in the i3 version), which google says has something to do
Steven> with PaX. They are both the same binary really, but the i3 has a few
Steven> kb of padding on the end (just empty space). I have no idea why; but
Steven> I'm sure someone will be able to help you.
https://blogs.gentoo.org/mgorny/2014/06/23/inlining-marchnative-for-distcc/
" You may also notice -fstack-protector there. This is because nowadays
" Gentoo enables it by default.
http://sources.gentoo.org/gitweb/?p=proj/gentoo-news.git;a=blob;f=2014/2014-06-15-gcc48_ssp/2014-06-15-gcc48_ssp.en.txt
which certainly seems to support the claim.
This looked promising. I tried it with -fno-stack-protector, but there
is no difference. I also added -fno-pie, still no joy.
Post by Bela LubkinThe two binaries contain .comment sections with "GCC: (GNU) 4.8.2" and
"GCC: (Gentoo 4.8.3 p1.1, pie-0.5.9) 4.8.3"; in which I *think* the
"pie-0.5.9" is another hint about hardening.
$ eselect profile list
Available profile symlink targets:
[1] default/linux/x86/13.0 *
[2] default/linux/x86/13.0/selinux
[3] default/linux/x86/13.0/desktop
[4] default/linux/x86/13.0/desktop/gnome
[5] default/linux/x86/13.0/desktop/gnome/systemd
[6] default/linux/x86/13.0/desktop/kde
[7] default/linux/x86/13.0/desktop/kde/systemd
[8] default/linux/x86/13.0/developer
[9] hardened/linux/x86
[10] hardened/linux/x86/selinux
[11] hardened/linux/musl/x86
[12] default/linux/uclibc/x86
[13] hardened/linux/uclibc/x86
Maybe some hardening features are somehow pulled when compiling with -static?
Just in case this contains some usefull info:
$ gcc -### -march=native -x c -
Using built-in specs.
COLLECT_GCC=/usr/i686-pc-linux-gnu/gcc-bin/4.8.3/gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/i686-pc-linux-gnu/4.8.3/lto-wrapper
Target: i686-pc-linux-gnu
Configured with:
/var/tmp/portage/sys-devel/gcc-4.8.3/work/gcc-4.8.3/configure
--host=i686-pc-linux-gnu --build=i686-pc-linux-gnu --prefix=/usr
--bindir=/usr/i686-pc-linux-gnu/gcc-bin/4.8.3
--includedir=/usr/lib/gcc/i686-pc-linux-gnu/4.8.3/include
--datadir=/usr/share/gcc-data/i686-pc-linux-gnu/4.8.3
--mandir=/usr/share/gcc-data/i686-pc-linux-gnu/4.8.3/man
--infodir=/usr/share/gcc-data/i686-pc-linux-gnu/4.8.3/info
--with-gxx-include-dir=/usr/lib/gcc/i686-pc-linux-gnu/4.8.3/include/g++-v4
--with-python-dir=/share/gcc-data/i686-pc-linux-gnu/4.8.3/python
--enable-languages=c,c++,fortran --enable-obsolete --enable-secureplt
--disable-werror --with-system-zlib --disable-nls
--enable-checking=release --with-bugurl=https://bugs.gentoo.org/
--with-pkgversion='Gentoo 4.8.3 p1.1, pie-0.5.9'
--enable-libstdcxx-time --enable-shared --enable-threads=posix
--enable-__cxa_atexit --enable-clocale=gnu --disable-multilib
--disable-altivec --disable-fixed-point --with-arch=i686
--enable-targets=all --disable-libgcj --enable-libgomp
--disable-libmudflap --disable-libssp --enable-lto --without-cloog
Thread model: posix
gcc version 4.8.3 (Gentoo 4.8.3 p1.1, pie-0.5.9)
COLLECT_GCC_OPTIONS='-march=native'
/usr/libexec/gcc/i686-pc-linux-gnu/4.8.3/cc1 -quiet -
"-march=core-avx2" -mcx16 -msahf -mmovbe -maes -mpclmul -mpopcnt -mabm
-mno-lwp -mfma -mno-fma4 -mno-xop -mbmi -mbmi2 -mno-tbm -mavx -mavx2
-msse4.2 -msse4.1 -mlzcnt -mno-rtm -mno-hle -mrdrnd -mf16c -mfsgsbase
-mno-rdseed -mno-prfchw -mno-adx -mfxsr -mxsave -mxsaveopt --param
"l1-cache-size=32" --param "l1-cache-line-size=64" --param
"l2-cache-size=3072" "-mtune=core-avx2" -quiet -dumpbase - -auxbase -
-fstack-protector -o /tmp/ccxOOjI3.s
COLLECT_GCC_OPTIONS='-march=native'
/usr/lib/gcc/i686-pc-linux-gnu/4.8.3/../../../../i686-pc-linux-gnu/bin/as
--32 -o /tmp/ccm6d0Pe.o /tmp/ccxOOjI3.s
COMPILER_PATH=/usr/libexec/gcc/i686-pc-linux-gnu/4.8.3/:/usr/libexec/gcc/i686-pc-linux-gnu/4.8.3/:/usr/libexec/gcc/i686-pc-linux-gnu/:/usr/lib/gcc/i686-pc-linux-gnu/4.8.3/:/usr/lib/gcc/i686-pc-linux-gnu/:/usr/lib/gcc/i686-pc-linux-gnu/4.8.3/../../../../i686-pc-linux-gnu/bin/
LIBRARY_PATH=/usr/lib/gcc/i686-pc-linux-gnu/4.8.3/:/usr/lib/gcc/i686-pc-linux-gnu/4.8.3/../../../../i686-pc-linux-gnu/lib/../lib/:/usr/lib/gcc/i686-pc-linux-gnu/4.8.3/../../../../lib/:/lib/../lib/:/usr/lib/../lib/:/usr/lib/gcc/i686-pc-linux-gnu/4.8.3/../../../../i686-pc-linux-gnu/lib/:/usr/lib/gcc/i686-pc-linux-gnu/4.8.3/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-march=native'
/usr/libexec/gcc/i686-pc-linux-gnu/4.8.3/collect2 --eh-frame-hdr -m
elf_i386 -dynamic-linker /lib/ld-linux.so.2
/usr/lib/gcc/i686-pc-linux-gnu/4.8.3/../../../../lib/crt1.o
/usr/lib/gcc/i686-pc-linux-gnu/4.8.3/../../../../lib/crti.o
/usr/lib/gcc/i686-pc-linux-gnu/4.8.3/crtbegin.o
-L/usr/lib/gcc/i686-pc-linux-gnu/4.8.3
-L/usr/lib/gcc/i686-pc-linux-gnu/4.8.3/../../../../i686-pc-linux-gnu/lib/../lib
-L/usr/lib/gcc/i686-pc-linux-gnu/4.8.3/../../../../lib -L/lib/../lib
-L/usr/lib/../lib
-L/usr/lib/gcc/i686-pc-linux-gnu/4.8.3/../../../../i686-pc-linux-gnu/lib
-L/usr/lib/gcc/i686-pc-linux-gnu/4.8.3/../../.. /tmp/ccm6d0Pe.o -lgcc
--as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s
--no-as-needed /usr/lib/gcc/i686-pc-linux-gnu/4.8.3/crtend.o
/usr/lib/gcc/i686-pc-linux-gnu/4.8.3/../../../../lib/crtn.o
Thanks,
Jorge