Subject: util-vserver segfault with SSP
From:Romain Rivière <romain+vserver@forty-two.fr>
Date: Wed, 13 Dec 2017 23:55:48 +0100

Hi there,

A couple of years ago, I remember reporting some issues with Gentoo's
hardened profile. Today, after a couple of upgrades, I investigated just
a tad further.

When building util-vserver with a hardened gcc, vserver-stat (maybe
others?) segfaults right out of the box:

# strace -f -s0 vserver-stat
 execve("/usr/sbin/vserver-stat", [...], [/* 40 vars */]) = 0
 --- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x28} ---
 +++ killed by SIGSEGV +++
 Segmentation fault

After some trial and error, I managed to determine that using the
"nossp" version of the hardened profile was key to obtaining usable
binaries. However, simply adding -fno-stack-protector to the CFLAGS is
not enough, so there must be something else.

It looks like a NULLDEREF right from the start, but that's about the
extent of my knowledge of C/C++, so I'd appreciate some input here :)

Cheers
-- 
Romain