Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4150488pxb; Mon, 8 Feb 2021 09:04:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJygrpLAOHHz82kMczVBiKEvP00rP4myebbLebFYOdh1sXCmAnKX4V1m5tuamL0Un95kt9vI X-Received: by 2002:a2e:3203:: with SMTP id y3mr2375047ljy.476.1612803868260; Mon, 08 Feb 2021 09:04:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612803868; cv=none; d=google.com; s=arc-20160816; b=jIsGChLzfld+yAP0ivKlaSRNzCwj77/ZR5GWufR7sbSz+CKa7N9yOG0SFDsa/+lvnV rgEm6H/kLi0PYB5YHSO65Qrc6xpsl8NzRpRUlapoSwwe0a3qvoyE7QzS89Lp+gdjtStm p/gTqDk+halmv+zwZbfoDjOqTTvcJyEGu7gnT5MENeVN46TzI56TXLyn2z3OGKhIJZBJ eiwbogOMJxMz7Z7yD3k4oNMN4fTJAUMY9yg0196S7dIuNP08iSFmJSnwlwKSMSmHljel kCBw/SX28GOOhAIF0nRdWc/CTfFdJc9CNlmeBT6BIBDJMmqUJC7pwgL6FIMKq0845UXg tmEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=OzGKKc0i1DyGzM+PMYMWIJoKu5jgC67+zjzclb+l1k4=; b=ZjAYYsmJssHr0vVm4dDQDcBbKbY+lc98iBtJ3YvwgPY74NuHWYjsI+WA99GLfYPzEv TYZpy6LCK6c+cEdIq/QJCgimZ/XelcFRmKCCQF84XOyKmTVZyaRAjOAR8zdNuC8DPx9N RxfZ/m7+9BxP66vi6qPTfzCPERXE3ZnnDkz6RaVBPCbOLB+JNGg8cNlwVxCpcdtBnCOX aHb0Slm51MRd2+yZjUJotDiKj6FxZrCwmi0529Br/EXSkjLT9CpGZElvWwFflmVPYpY1 n/ehNAwjkiz232d6vayktBkbvAfSEhMMajIefK+WlBmoh+3tmTE1/0MDzyLkEwvEUNUd H/CQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="uYqI7/VS"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u10si5330447eda.107.2021.02.08.09.04.03; Mon, 08 Feb 2021 09:04:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="uYqI7/VS"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234801AbhBHRCv (ORCPT + 99 others); Mon, 8 Feb 2021 12:02:51 -0500 Received: from mail.kernel.org ([198.145.29.99]:34484 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231697AbhBHPSs (ORCPT ); Mon, 8 Feb 2021 10:18:48 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id C9FF664F02; Mon, 8 Feb 2021 15:12:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1612797132; bh=/lB1CqoITpXl91Hx5Owmq4+rsmXz8vTSzRSAOHty2oI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uYqI7/VSUHPfQPu/7YwQAaqd2KyLaFztC8DVKfKpFU+BFZ5P0KcmHXHcphT1jaGVA T6ZqmC1siOMZZHxtvLLkPSFGFn+jQfa3KE1wGpMZiKizI5ioDm25UG3AQJHliQrUhu 9dIJJRxMvLL3WKpAlpH1ArYHDOyz+o2neSfrJnsM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nikolay Borisov , Josh Poimboeuf , Borislav Petkov , Seth Forshee , Masahiro Yamada Subject: [PATCH 5.4 54/65] x86/build: Disable CET instrumentation in the kernel Date: Mon, 8 Feb 2021 16:01:26 +0100 Message-Id: <20210208145812.313985463@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210208145810.230485165@linuxfoundation.org> References: <20210208145810.230485165@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Josh Poimboeuf commit 20bf2b378729c4a0366a53e2018a0b70ace94bcd upstream. With retpolines disabled, some configurations of GCC, and specifically the GCC versions 9 and 10 in Ubuntu will add Intel CET instrumentation to the kernel by default. That breaks certain tracing scenarios by adding a superfluous ENDBR64 instruction before the fentry call, for functions which can be called indirectly. CET instrumentation isn't currently necessary in the kernel, as CET is only supported in user space. Disable it unconditionally and move it into the x86's Makefile as CET/CFI... enablement should be a per-arch decision anyway. [ bp: Massage and extend commit message. ] Fixes: 29be86d7f9cb ("kbuild: add -fcf-protection=none when using retpoline flags") Reported-by: Nikolay Borisov Signed-off-by: Josh Poimboeuf Signed-off-by: Borislav Petkov Reviewed-by: Nikolay Borisov Tested-by: Nikolay Borisov Cc: Cc: Seth Forshee Cc: Masahiro Yamada Link: https://lkml.kernel.org/r/20210128215219.6kct3h2eiustncws@treble Signed-off-by: Greg Kroah-Hartman --- Makefile | 6 ------ arch/x86/Makefile | 3 +++ 2 files changed, 3 insertions(+), 6 deletions(-) --- a/Makefile +++ b/Makefile @@ -920,12 +920,6 @@ KBUILD_CFLAGS += $(call cc-option,-Wer # change __FILE__ to the relative path from the srctree KBUILD_CFLAGS += $(call cc-option,-fmacro-prefix-map=$(srctree)/=) -# ensure -fcf-protection is disabled when using retpoline as it is -# incompatible with -mindirect-branch=thunk-extern -ifdef CONFIG_RETPOLINE -KBUILD_CFLAGS += $(call cc-option,-fcf-protection=none) -endif - include scripts/Makefile.kasan include scripts/Makefile.extrawarn include scripts/Makefile.ubsan --- a/arch/x86/Makefile +++ b/arch/x86/Makefile @@ -131,6 +131,9 @@ else KBUILD_CFLAGS += -mno-red-zone KBUILD_CFLAGS += -mcmodel=kernel + + # Intel CET isn't enabled in the kernel + KBUILD_CFLAGS += $(call cc-option,-fcf-protection=none) endif ifdef CONFIG_X86_X32