From mboxrd@z Thu Jan 1 00:00:00 1970 From: ng0 Subject: Re: hardening Date: Sun, 11 Mar 2018 13:37:32 +0000 Message-ID: <20180311133732.ojqacszx2mckvdim@abyayala> References: <87a7wwesx2.fsf@abyayala.i-did-not-set--mail-host-address--so-tickle-me> <871si6w76r.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:37953) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ev1AP-0007rE-HL for guix-devel@gnu.org; Sun, 11 Mar 2018 09:37:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ev1AM-00013d-CB for guix-devel@gnu.org; Sun, 11 Mar 2018 09:37:37 -0400 Received: from aibo.runbox.com ([91.220.196.211]:46952) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ev1AM-00012v-4Y for guix-devel@gnu.org; Sun, 11 Mar 2018 09:37:34 -0400 Content-Disposition: inline In-Reply-To: <871si6w76r.fsf@gmail.com> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Alex Vong Cc: guix-devel@gnu.org, ng0@n0.is Alex Vong transcribed 1.3K bytes: > Hello, > > ng0@n0.is writes: > > > Hi, > > > > as we've long talked and not really taken action on hardening builds > > I've started working on an opt-in way as last discussed in > > september 2016, modifying the gnu-build-system with a > > #:hardening-flags keyword. > > > > For my testing purposes I will use > > > >> CFLAGS="-fPIE -fstack-protector-all -D_FORTIFY_SOURCE=2" > > LDFLAGS="-Wl,-z,now -Wl,-z,relro" > > > > which is used by Gentoo, but adjustments (wether to opt-in or > > opt-out) will be made. > > The flags I use (suggested by Debian Wiki[0]) are: > > CPPFLAGS=-D_FORTIFY_SOURCE=2 How does this differ from "-O2 -D_FORTIFY_SOURCE" in CFLAGS? I know O2 is optimization and that FORTIFY_SOURCE requires optimization to be specified. > CFLAGS=-fstack-protector-strong > CXXFLAGS=-fstack-protector-strong > LDFLAGS=-Wl,-z,relro,-z,now,--as-needed What are your opinions about: -pipe -fPIE -fstack-shuffle -fstack-protector-all > Also, should we use retpoline flags for all native binaries? This > article[1] suggests ``applying a software mitigation (e.g., Google's > Retpoline) to the hypervisor, operating system kernel, system programs > and libraries, and user applications''. I've sent a patch to do so when > bootstraping GCC 7 itself[2] but no reply are received yet (maybe I > should have open a new bug instead of changing the title of an old > bug). > > [0]: https://wiki.debian.org/Hardening > [1]: https://security.googleblog.com/2018/01/more-details-about-mitigations-for-cpu_4.html > [2]: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=30111 > -- A88C8ADD129828D7EAC02E52E22F9BBFEE348588 https://n0.is