Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp733876ybb; Wed, 25 Mar 2020 08:35:25 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsEmD8wZGZeX3d9EqkMLADeacOcH3X1hBeagmgCHpRsnOCaeyjumm7ZBupOWaaKJSYBxuqD X-Received: by 2002:aca:4d49:: with SMTP id a70mr2971332oib.152.1585150525734; Wed, 25 Mar 2020 08:35:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585150525; cv=none; d=google.com; s=arc-20160816; b=fuJ7Nz398NQa5DtEvNQEAQYexSr1Op3ZfY3bWzLyo5hR7GqKJyVoMlMUNODm6yqPau dsQkIdA60lT3Uc2lry6goFG6tMcuZmXn8koET1GvV77EY0iw/UjL2jxr7Lofy6Axt7H1 rbpUZK73sbkeItVxhzGLlJD21DvivE9jtALLytKFcf0Crw/aHWHamgz6tMHoiO8FrMbE n30ZIhC8ZSO9AKpc62j5BaaSiDc5VMUODel4sc7aClslL+rPqjAi/bNbm54f4SmiuYCr EVEDX6+dBb+NA3GbBFqNnt91tPwRazo30gdSJHTra9VWoU2evwgzJsDHD9PXXBP+jC0o rbcw== 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=ehziNPeaBvtJLg13Ry2+oGWqU/h8Z30gqipX1jtupZo=; b=Cly9xzM7Fz5f7X9/d7qrCX37+Plp5IxcfWSorG/qcpUbGYNG9ZWpZ1QGwAuCr7bvmL ItqxfqKpFwBF5F3tjOLlabDjVnDgylmGF5PMY8ITg0rftwV0OKVWyxl/TupsUH9R7TvI +v6xA6sYkiiYMgDWZsS8es1U6hX9M3vSH9RMiCQuuUvHh+kpWsNhjSom9cLcnUuRAWan cd2EKF7C752oGCUMjIV/ZBPfUpJ3osqpdtcZFx84GlKxQC/8wazal4YIJIsBjDigelHa e6RHl1JqyMj4BoGQSRk+d4FngKH8U4dZPFLygrTKup+9oOMR/8CtTZaB3VV3rqf0XcOp EkFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=jf9VMJu8; 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 n64si8893390oih.256.2020.03.25.08.35.12; Wed, 25 Mar 2020 08:35:25 -0700 (PDT) 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=jf9VMJu8; 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 S1727773AbgCYPe0 (ORCPT + 99 others); Wed, 25 Mar 2020 11:34:26 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:42993 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727491AbgCYPe0 (ORCPT ); Wed, 25 Mar 2020 11:34:26 -0400 Received: by mail-pf1-f196.google.com with SMTP id 22so1194365pfa.9 for ; Wed, 25 Mar 2020 08:34:25 -0700 (PDT) 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=ehziNPeaBvtJLg13Ry2+oGWqU/h8Z30gqipX1jtupZo=; b=jf9VMJu8DVs0x+Z49kPRCZTQoMvHgkYdC9Kpmy0uQgm4UR9jFf/L7dIviuoIwP9ZNi iiac4DCON+0EuJPysY6VP8AqQwEHrl0R5fMHVBTeNtr8ohxjVd6nOXrFqQDEFIu5CDRY fxLV9xf1LaZTggHKl75w0RxgGrxFRHowY8HBM= 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=ehziNPeaBvtJLg13Ry2+oGWqU/h8Z30gqipX1jtupZo=; b=j+MbjCgVVDUTCPJ8UmdzIf4qYYccm9qw2Ivk/5h1N8ymZUJYx5sNaMsZ30PPNgfKss 2ZYk6TcNAFN6+ia9WN+AGtdi8fuXy/mSSnc2F2X1ENmgtjXd/DiEAtNDYNv0SFhxX0EM bWYJGdJkuFfVNjLu1Pvldqm4sPNeRzfY+U1XfdpWicjMfO5CLeP+lCLfGK8sUxkRHsw3 5M1r+Y3wuIMXwEsDjYyqN9z/YT0RUDqKt8rApWoAbCHcngjxhHfu6kwn47R+a4Lbphko VtdfbW1ubEeeoPL8NYNiCTJ2jS4bdxddgOI15d2HBafkk6jYh974wnMqmO1x2yPGP2jI UbGQ== X-Gm-Message-State: ANhLgQ05y9bC4Mxf3A4DdAulHHZmKGx52Gv79A2U8h2PRO+n+uE0ZsnW uEpojB+CqBKpG77EN7SWVuiIks1yxn8= X-Received: by 2002:a62:7811:: with SMTP id t17mr4024383pfc.268.1585150465380; Wed, 25 Mar 2020 08:34:25 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id a24sm18272569pfl.115.2020.03.25.08.34.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Mar 2020 08:34:24 -0700 (PDT) Date: Wed, 25 Mar 2020 08:34:23 -0700 From: Kees Cook To: Kristen Carlson Accardi Cc: Arvind Sankar , 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: <202003250832.058B12D3@keescook> References: <20200205223950.1212394-1-kristen@linux.intel.com> <20200205223950.1212394-6-kristen@linux.intel.com> <20200225175544.GA1385238@rani.riverdale.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 24, 2020 at 02:24:51PM -0700, Kristen Carlson Accardi wrote: > On Tue, 2020-02-25 at 12:55 -0500, Arvind Sankar 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 > > > + > > > > With -ffunction-sections I get a few unreachable code warnings from > > objtool. > > > > [...] > > net/mac80211/ibss.o: warning: objtool: > > ieee80211_ibss_work.cold()+0x157: unreachable instruction > > drivers/net/ethernet/intel/e1000/e1000_main.o: warning: objtool: > > e1000_clean.cold()+0x0: unreachable instruction > > net/core/skbuff.o: warning: objtool: skb_dump.cold()+0x3fd: > > unreachable instruction > > I'm still working on a solution, but the issue here is that any .cold > function is going to be in a different section than the related > function, and when objtool is searching for instructions in > find_insn(), it assumes that it must be in the same section as the > caller. Can we teach objtool about this? It doesn't seem too unreasonable. -- Kees Cook