Received: by 10.213.65.68 with SMTP id h4csp428095imn; Tue, 13 Mar 2018 08:45:09 -0700 (PDT) X-Google-Smtp-Source: AG47ELvxSXEm/h0VzWqg6OG2Hoj7TFFPy7CvvQ3UiXm7MQ+FMKYeHp1tYT84XrAPhEBXP4fJvV6Q X-Received: by 10.99.113.94 with SMTP id b30mr867171pgn.196.1520955909092; Tue, 13 Mar 2018 08:45:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520955909; cv=none; d=google.com; s=arc-20160816; b=MlBJz+TZnf+AD1QsnUxiirkx4ZFDTx4ITGjyxET6wWvGY2XBEG6SqMf3+bt2V0YUZX dVd7H3J4TohhHv8NykHft7GowCGxxBLFUqkwM5MSrNQhWPP2l1gAvVkzHkCAaZmr/Usg DPzbG0uPm/ErnR0ik68Mq0JCFvzlEY5M1pR/G6VCTT0rrdy+TJQMAs9GLa8X/mKfc9go Em5h2mH+UURgp8tNHsS2DCVRsimb2S9xO5FIdunGtSX331w2y6+svTMzTEHgltPE+qMz FAfVw8Qe9+qpy7cfcy+x+jVMS7x3BaUuFHBwcpaECtJNNPgGNucKmy1guERhitghwKwj CMlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=sT2gVHnWloXdEBfg7LWu0DUXN2r3HfZOQbd3+ImbytQ=; b=ZKW9l6fD/f/+TS80tVTTTdTymOfDCAww214XiUKUU1MgZ+b+DdSlh+C+HaABztFvBz NicercTmuUzTKY1n481gDflT6pT8r4wMa3pkthEzkuRQdfFTHCYG2d6zd1g9qhl7WsCe /HBtRwoSML8BViWXDf8JVh1l3slcUl0uF5kDve03vexbLx5k3caqpOHuwAMjdXAQQyvi v/JJhueEAyrrMyJmQHVgdinG2xaZW6029csn86v47p00+PJwgeVk5o5iB4nYE4gTMR/p i61N1GneI/3JWQvPweUTyn/fU4Y7YLVLgzFLKNqgMfEb6qSbr3fb21wWf5HTu34w9kl7 Ev0g== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e12-v6si306175plj.126.2018.03.13.08.44.54; Tue, 13 Mar 2018 08:45:09 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964905AbeCMPnY (ORCPT + 99 others); Tue, 13 Mar 2018 11:43:24 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:37084 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964847AbeCMPll (ORCPT ); Tue, 13 Mar 2018 11:41:41 -0400 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id BAF29126E; Tue, 13 Mar 2018 15:41:32 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Peter Zijlstra (Intel)" , Thomas Gleixner , Andy Lutomirski , Arjan van de Ven , Borislav Petkov , Dan Williams , Dave Hansen , David Woodhouse , Josh Poimboeuf , Linus Torvalds , Ingo Molnar Subject: [PATCH 4.14 137/140] objtool, retpolines: Integrate objtool with retpoline support more closely Date: Tue, 13 Mar 2018 16:25:40 +0100 Message-Id: <20180313152507.382458750@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180313152458.201155692@linuxfoundation.org> References: <20180313152458.201155692@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 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 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Peter Zijlstra commit d5028ba8ee5a18c9d0bb926d883c28b370f89009 upstream. Disable retpoline validation in objtool if your compiler sucks, and otherwise select the validation stuff for CONFIG_RETPOLINE=y (most builds would already have it set due to ORC). Signed-off-by: Peter Zijlstra (Intel) Acked-by: Thomas Gleixner Cc: Andy Lutomirski Cc: Arjan van de Ven Cc: Borislav Petkov Cc: Dan Williams Cc: Dave Hansen Cc: David Woodhouse Cc: Greg Kroah-Hartman Cc: Josh Poimboeuf Cc: Linus Torvalds Cc: Peter Zijlstra Signed-off-by: Ingo Molnar Signed-off-by: Greg Kroah-Hartman --- Makefile | 5 +++++ arch/x86/Kconfig | 1 + arch/x86/Makefile | 10 +++------- scripts/Makefile.build | 2 ++ 4 files changed, 11 insertions(+), 7 deletions(-) --- a/Makefile +++ b/Makefile @@ -494,6 +494,11 @@ KBUILD_CFLAGS += $(CLANG_TARGET) $(CLANG KBUILD_AFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC) endif +RETPOLINE_CFLAGS_GCC := -mindirect-branch=thunk-extern -mindirect-branch-register +RETPOLINE_CFLAGS_CLANG := -mretpoline-external-thunk +RETPOLINE_CFLAGS := $(call cc-option,$(RETPOLINE_CFLAGS_GCC),$(call cc-option,$(RETPOLINE_CFLAGS_CLANG))) +export RETPOLINE_CFLAGS + ifeq ($(config-targets),1) # =========================================================================== # *config targets only - make sure prerequisites are updated, and descend --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -431,6 +431,7 @@ config GOLDFISH config RETPOLINE bool "Avoid speculative indirect branches in kernel" default y + select STACK_VALIDATION if HAVE_STACK_VALIDATION help Compile kernel with the retpoline compiler options to guard against kernel-to-user data leaks by avoiding speculative indirect --- a/arch/x86/Makefile +++ b/arch/x86/Makefile @@ -232,13 +232,9 @@ KBUILD_CFLAGS += -fno-asynchronous-unwin # Avoid indirect branches in kernel to deal with Spectre ifdef CONFIG_RETPOLINE - RETPOLINE_CFLAGS_GCC := -mindirect-branch=thunk-extern -mindirect-branch-register - RETPOLINE_CFLAGS_CLANG := -mretpoline-external-thunk - - RETPOLINE_CFLAGS += $(call cc-option,$(RETPOLINE_CFLAGS_GCC),$(call cc-option,$(RETPOLINE_CFLAGS_CLANG))) - ifneq ($(RETPOLINE_CFLAGS),) - KBUILD_CFLAGS += $(RETPOLINE_CFLAGS) -DRETPOLINE - endif +ifneq ($(RETPOLINE_CFLAGS),) + KBUILD_CFLAGS += $(RETPOLINE_CFLAGS) -DRETPOLINE +endif endif archscripts: scripts_basic --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -272,8 +272,10 @@ else objtool_args += $(call cc-ifversion, -lt, 0405, --no-unreachable) endif ifdef CONFIG_RETPOLINE +ifneq ($(RETPOLINE_CFLAGS),) objtool_args += --retpoline endif +endif ifdef CONFIG_MODVERSIONS