Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1426444ybv; Thu, 6 Feb 2020 03:58:35 -0800 (PST) X-Google-Smtp-Source: APXvYqyiTh57EjqHRLMPFyGg7ZiZMmNAYS9qeqm68IK1CNwsXNWqoew0fGFsIbFfCmqCzZRhq0DK X-Received: by 2002:a9d:7a56:: with SMTP id z22mr19141979otm.201.1580990315293; Thu, 06 Feb 2020 03:58:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580990315; cv=none; d=google.com; s=arc-20160816; b=SHBXVGwCgX8Mxg7kb5RmRYgyeZvg89CdfuzqSlfamxhFs2ci/2EONiQK6FbiA+1Htn /OQ9TwczJ8mwq36Gbaa7PqBXRKNt5veVSED3UBoma3lmITiWb65+WUSuyf+7Z7KGHdnR Pv3We/6vLJQpfqLyze6YuOK+A8PJi3YR6K8olwi519R6uL/oPlHd7kG6mlI0RC6EDMM7 S5EKNF/HVO4SFeR7uAhpW63VG3o/FovJt/JqGmakJD9hbdNesnBiNXc9phTUFpuCYjEx v60wZPuzTm5SV1K4VRuVly/KIVa9IGxGiiaNY24tmHv7ShzWbn8ero29aZMAWHenHOkg vw+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=QoBuf+g4Xxni6UvGzXiTkNzIActsAJcHEvJL0GRcYx8=; b=SnGucq8m95n1PcmRTCA/lOza1nx2zMUhKZavxx457FHYLghyjb2KxmNAB0aaJ8B+LK rzKVnCDNTU7Wek/sgaita6BaQUf5rg58Gog8OOE9fvHgtYJOrMoImAnBFh+8A/+6XjTL rcvmAJBojjC83UfxIqs/+e9sZHMUMQ6tGn++DeNzrYCKlOsVoY4UnQJcUBfGulfSyOPY BSLt8/+cI0+FzmKy5wLri8V7g8cq+FgrSYDfxxOfHyKZ0ppcyk3e4GIJ0G+6fhVtLDk+ zReTpnHp3qVq2n3eI+flU7RyP9LC7lN43mGGnhnNzoMAd5mJA17gOfXdoLqXXUcKYhy6 4VxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=R5Xlq0RI; 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=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v18si1928540otn.174.2020.02.06.03.58.23; Thu, 06 Feb 2020 03:58:35 -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=@chromium.org header.s=google header.b=R5Xlq0RI; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727604AbgBFLw5 (ORCPT + 99 others); Thu, 6 Feb 2020 06:52:57 -0500 Received: from mail-oi1-f195.google.com ([209.85.167.195]:45230 "EHLO mail-oi1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727111AbgBFLw5 (ORCPT ); Thu, 6 Feb 2020 06:52:57 -0500 Received: by mail-oi1-f195.google.com with SMTP id v19so4255662oic.12 for ; Thu, 06 Feb 2020 03:52:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=QoBuf+g4Xxni6UvGzXiTkNzIActsAJcHEvJL0GRcYx8=; b=R5Xlq0RIQQTLqUa8qKTou4rSksjpBBz9TjP86XXO7E4Tuwiieo96zVVhZlH+93zGUD bzlD31tE81BY9v+0GAYnBV5v+V5sXbyvABDV4DA88MsG+3PLxSee4lU73cccmps87FQN cCxYxdTQRfEpxBAhyyx8hTq7URx4/raEeFZkM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=QoBuf+g4Xxni6UvGzXiTkNzIActsAJcHEvJL0GRcYx8=; b=S7Cu9aU4zjA1CBNfah8uwySKDVvYmtvK2yNMW9yhiQ1XtQbamvsG2b2xerViEmkjEb qZ8aY1lO2wBNJKH4oCWBN97b74Nn+jCjgmHAQRnjPxzNTablVAhDFecf8S+JWeyz1/ds WNPvezrbrFQ4tm1h4k3S2I9t1inhBMPuSNEnRc12N4HGQgJysmpGOJ0I+6J+qMWAiyH9 2hulSc50uVy+iQ59A7p5tIBLk2XsowfSVlscUbdQirtY6JGZA9xeX2i43Jh7/58Z5n6s IdLzLrtL9jLbg985qT1AFNjcsAbOO/pZsUlFnOSP7cyU23qjxXkoBJQndTRjF+d9ej4G NNbw== X-Gm-Message-State: APjAAAWKfYw+HwNKVOvPwTKEZnV125Jk0Jv0ShEkI6AxTGEBVPSpqOP4 hFa7DSy4Iy9g+sXL4c1JSiwwAg== X-Received: by 2002:a05:6808:b29:: with SMTP id t9mr6587780oij.69.1580989976311; Thu, 06 Feb 2020 03:52:56 -0800 (PST) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id k192sm821809oib.55.2020.02.06.03.52.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Feb 2020 03:52:55 -0800 (PST) Date: Thu, 6 Feb 2020 03:52:54 -0800 From: Kees Cook To: Peter Zijlstra Cc: Kristen Carlson Accardi , tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, hpa@zytor.com, arjan@linux.intel.com, rick.p.edgecombe@intel.com, x86@kernel.org, linux-kernel@vger.kernel.org, kernel-hardening@lists.openwall.com Subject: Re: [RFC PATCH 05/11] x86: Makefile: Add build and config option for CONFIG_FG_KASLR Message-ID: <202002060348.7543F4D5@keescook> References: <20200205223950.1212394-1-kristen@linux.intel.com> <20200205223950.1212394-6-kristen@linux.intel.com> <20200206103055.GV14879@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200206103055.GV14879@hirez.programming.kicks-ass.net> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 06, 2020 at 11:30:55AM +0100, Peter Zijlstra wrote: > On Wed, Feb 05, 2020 at 02:39:44PM -0800, Kristen Carlson Accardi wrote: > > Allow user to select CONFIG_FG_KASLR if dependencies are met. Change > > the make file to build with -ffunction-sections if CONFIG_FG_KASLR > > > > Signed-off-by: Kristen Carlson Accardi > > --- > > Makefile | 4 ++++ > > arch/x86/Kconfig | 13 +++++++++++++ > > 2 files changed, 17 insertions(+) > > > > diff --git a/Makefile b/Makefile > > index c50ef91f6136..41438a921666 100644 > > --- a/Makefile > > +++ b/Makefile > > @@ -846,6 +846,10 @@ ifdef CONFIG_LIVEPATCH > > KBUILD_CFLAGS += $(call cc-option, -flive-patching=inline-clone) > > endif > > > > +ifdef CONFIG_FG_KASLR > > +KBUILD_CFLAGS += -ffunction-sections > > +endif > [...] > In particular: > > "They prevent optimizations by the compiler and assembler using > relative locations inside a translation unit since the locations are > unknown until link time." I think this mainly a feature of this flag, since it's those relocations that are used to do the post-shuffle fixups. But yes, I would imagine this has some negative impact on code generation. > I suppose in practise this only means tail-calls are affected and will > no longer use JMP.d8. Or are more things affected? It's worth looking at. I'm also curious to see how this will interact with Link Time Optimization. -- Kees Cook