From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (1.0) Subject: Re: [PATCH v6 20/27] x86: Support global stack cookie From: Andy Lutomirski In-Reply-To: Date: Fri, 1 Feb 2019 14:36:24 -0800 Content-Transfer-Encoding: quoted-printable Message-Id: <777DD215-A4F5-454F-856F-FFE870F15CDD@amacapital.net> References: <20190131192533.34130-1-thgarnie@chromium.org> <20190131192533.34130-21-thgarnie@chromium.org> To: Thomas Garnier Cc: Andy Lutomirski , Kernel Hardening , Kristen Carlson Accardi , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , X86 ML , Masahiro Yamada , Juergen Gross , Joerg Roedel , Jia Zhang , Konrad Rzeszutek Wilk , Tim Chen , LKML List-ID: > On Feb 1, 2019, at 12:21 PM, Thomas Garnier wrote:= >=20 >> On Fri, Feb 1, 2019 at 11:27 AM Andy Lutomirski wrote: >>=20 >>> On Thu, Jan 31, 2019 at 11:29 AM Thomas Garnier w= rote: >>>=20 >>> Add an off-by-default configuration option to use a global stack cookie >>> instead of the default TLS. This configuration option will only be used >>> with PIE binaries. >>>=20 >>> For kernel stack cookie, the compiler uses the mcmodel=3Dkernel to switc= h >>> between the fs segment to gs segment. A PIE binary does not use >>> mcmodel=3Dkernel because it can be relocated anywhere, therefore the >>> compiler will default to the fs segment register. This is fixed on the >>> latest version of gcc. >>=20 >> I hate all these gcc-sucks-so-we-hack-it-and-change-nasty-semantics >> options. How about just preventing use of both stack protector and >> PIE unless the version of gcc in use is new enough. >=20 > So fail the build in this scenario? Fail the build or use some Kconfig magic to prevent this from being configur= ed in the first place. >=20 >>=20 >> Also, does -mstack-protector-guard-reg not solve this? See >> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D81708. Or is there >> another bug? Or are you worried about gcc versions that don't have >> that feature yet? >=20 > I am worried about gcc versions that don't have this feature, yes.