Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp907460ima; Fri, 1 Feb 2019 12:55:46 -0800 (PST) X-Google-Smtp-Source: AHgI3IamgpRyS0qtDB7T9le9yGAgPXvTi0RUskKxemmB8ajzVX5EcK7knVZv9Es4HJ0ePcv/+YZK X-Received: by 2002:a63:554b:: with SMTP id f11mr3850678pgm.37.1549054546852; Fri, 01 Feb 2019 12:55:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549054546; cv=none; d=google.com; s=arc-20160816; b=cK/IQbDXJ4HqQMp5ZtAYd3lXzm8CrZxct3iagqi5/Mg3Qhh2OpidDUD5e/TJ5MCKiL IV9ZbqzJPyFfvb21rCX1ZRC5ZDREea9haxzOFyTbimkRjnGdJkmP666WjHqO8p5koCR1 uxvom0jF7WQ25g3KauvFtidsjOmjC12hd5IztT/9kY6tWShp+xgGMWYF9J904/M1IYw+ GW1chVFAB7yM6JlDDgqLzjs6Q4UowlOS2I18i+uFuaF1FAzT+qoAXLe79TtxFQe6JOmN bkqIVkEf7Fb0x56Q1L1TSFKzKxTyBghl26lfWLtMqmGG/XGvOtrdqvGxLwGW+oLBesex gQcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=HBlFHWosvUT/tDkZ1F4yYWLz9b/VpozIM8u2x+CpZpk=; b=SV2ShPxG7IzC0AeMLlPuS2mSBU9/dyXlqSXDoGtWDuBJPiNyuPZnM49TSnACIHsHIo y3D1aO7Cdi072mywmzm3BWG1K2AMQfbGCTJSlRaijoEMtXsqlr+9cwPaARjX3BbzKIxU dw8/AABGhll7dDoDbBWZwHgWezxxLrK+jcgYY8TVHykRWgNchngv+FjkWAC3Ux2RmZXH NjT+Uda+1vN6j6eE4tbnEndNoCpKa3BLarKKIiFd3hyDgeUFVwc0pWkT3CPSieTFI/Yg jswv4ZtqaUveIM130AB/rFgjjDCo9rA8oQVOOQrJrdxJYXJQYP8Hyr6sQ4EkZx1GaHoI 6idg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rZJxaFWo; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t12si8364688plr.311.2019.02.01.12.55.31; Fri, 01 Feb 2019 12:55:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rZJxaFWo; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727992AbfBAT1i (ORCPT + 99 others); Fri, 1 Feb 2019 14:27:38 -0500 Received: from mail.kernel.org ([198.145.29.99]:56340 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726224AbfBAT1i (ORCPT ); Fri, 1 Feb 2019 14:27:38 -0500 Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3060821908 for ; Fri, 1 Feb 2019 19:27:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549049257; bh=i/42Ix6BSJ2O9QTvPZdAzHGqiD6AReRsP2p4D+VZYVY=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=rZJxaFWoGdki3rioPIMVk+6BdywslYixaEORk//wp1flvoP5JcRL3WXrmbRkXwBQT 9ixT3/z97/pmjEqtABLl37AC+YcqCGciiUG6OiJvLhSjGg0WkQ5UhkVPmk0ppDuII+ 6T6dDTYxOMXITLWW1T0zdiEPNWLW1r6IRgTZ5/tA= Received: by mail-wm1-f46.google.com with SMTP id f188so7314443wmf.5 for ; Fri, 01 Feb 2019 11:27:37 -0800 (PST) X-Gm-Message-State: AHQUAuYObndxOAsVHs2oekVH/G5AyBNrAfJYNMtS0qFk0+9zY+SNVr69 5VNJmhpbGz7+2XX6iwEGEqzQuogOi4sdpPyMbISn6g== X-Received: by 2002:a1c:f909:: with SMTP id x9mr3639529wmh.108.1549049255528; Fri, 01 Feb 2019 11:27:35 -0800 (PST) MIME-Version: 1.0 References: <20190131192533.34130-1-thgarnie@chromium.org> <20190131192533.34130-21-thgarnie@chromium.org> In-Reply-To: <20190131192533.34130-21-thgarnie@chromium.org> From: Andy Lutomirski Date: Fri, 1 Feb 2019 11:27:22 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v6 20/27] x86: Support global stack cookie To: Thomas Garnier Cc: Kernel Hardening , Kristen Carlson Accardi , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , X86 ML , Andy Lutomirski , Thomas Garnier , Masahiro Yamada , Juergen Gross , Joerg Roedel , Jia Zhang , Konrad Rzeszutek Wilk , Tim Chen , LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 31, 2019 at 11:29 AM Thomas Garnier wrote: > > 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. > > For kernel stack cookie, the compiler uses the mcmodel=kernel to switch > between the fs segment to gs segment. A PIE binary does not use > mcmodel=kernel 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. 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. Also, does -mstack-protector-guard-reg not solve this? See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81708. Or is there another bug? Or are you worried about gcc versions that don't have that feature yet?