Received: by 10.213.65.68 with SMTP id h4csp452133imn; Tue, 13 Mar 2018 09:29:36 -0700 (PDT) X-Google-Smtp-Source: AG47ELvdfTRdIh6Jh0GEcmqLJXZE98X0Fpd60BxitOgi4QYn6uwZsRxvTue6bbZ0vru6uxCBccvZ X-Received: by 2002:a17:902:6184:: with SMTP id u4-v6mr1126842plj.390.1520958575961; Tue, 13 Mar 2018 09:29:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520958575; cv=none; d=google.com; s=arc-20160816; b=TfbhET7g8qLmKbsZP16F0OW6hA9J4SF1dWsY4zhE+02fcxXoglAng1zu1cq8lFnm+J CPV24MY9WHHu8zWJ4RzjdsZYSWZTsBxOaeOlyqZzBISnuAJxytcJO+DcjqnAX5TQa4OY EqhOBiS4rgBD2rd70J3962lgx2BnRZmftRen+NejTAu2e7a4ezvgqi+RblkDyVr5WcVQ Fipr2BoxXIY8aAuvlp3ZtGcM31lo9hqUpqjotW+zespRoplF1e7Ki1Ax+TFcjPTNz1e6 gMueKnNdqW4H/dpbYO3G+hOmT+zEdO7XYLpv3PSTLt/CBi/GZafckZk8QwhKz0GTDKOH LiyQ== 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=L5cNd4HnMxs/3gB0HGp63UITxWuj/A7bbhFQfsVxDxE=; b=Vb2BAiFYx01mra3I6SeDA/bZLlcXanXZIcIu0/WOyiTVTIhdtMj47lf6YResf8yuD+ LsddQgfR7xRIyuCWatGqX8yuGQqazk6Omddq8WUB5+JTYtQvw6EfRVZGYFPyXogc+VjS IUraQlT2llAyUkpntnXiFEHoWSiOzRQpNCGfffIaHMA8IoB3c2rC+VbEVK1NClQ9buSJ tvoObiPuMzCsobDDb/EuYtceGtbBQk+11gh5iplCGSQtxaHmIIYOUQOo16N/8oXLu9CY gcAiqQ8u+hq8h/b/PXDyZe3g7GZ15BQfVQSbDsyBYBbLApbX0+StWhx+ukhnLo3syURy VUXQ== 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 j2si327716pff.214.2018.03.13.09.29.21; Tue, 13 Mar 2018 09:29:35 -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 S933578AbeCMPdb (ORCPT + 99 others); Tue, 13 Mar 2018 11:33:31 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:60690 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933544AbeCMPd2 (ORCPT ); Tue, 13 Mar 2018 11:33:28 -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 8546AC3C; Tue, 13 Mar 2018 15:33:27 +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.15 100/146] objtool, retpolines: Integrate objtool with retpoline support more closely Date: Tue, 13 Mar 2018 16:24:27 +0100 Message-Id: <20180313152328.262644942@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180313152320.439085687@linuxfoundation.org> References: <20180313152320.439085687@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.15-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 @@ -487,6 +487,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 @@ -432,6 +432,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 @@ -267,8 +267,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