blob: 23f89207ae26a12c12e78fffaed6d87cc0d79477 [file] [log] [blame]
Lorenz Brun0bcaaee2019-11-06 12:42:39 +01001Copyright 2020 The Monogon Project Authors.
2
3Licensed under the Apache License, Version 2.0 (the "License");
4you may not use this file except in compliance with the License.
5You may obtain a copy of the License at
6
7 http://www.apache.org/licenses/LICENSE-2.0
8
9Unless required by applicable law or agreed to in writing, software
10distributed under the License is distributed on an "AS IS" BASIS,
11WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12See the License for the specific language governing permissions and
13limitations under the License.
14
15
16From patchwork Tue Jul 9 18:49:19 2019
17Content-Type: text/plain; charset="utf-8"
18MIME-Version: 1.0
19Content-Transfer-Encoding: 7bit
20X-Patchwork-Submitter: Seth Forshee <seth.forshee@canonical.com>
21X-Patchwork-Id: 11037379
22Return-Path: <linux-kbuild-owner@kernel.org>
23Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org
24 [172.30.200.125])
25 by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EFE1413A4
26 for <patchwork-linux-kbuild@patchwork.kernel.org>;
27 Tue, 9 Jul 2019 18:49:26 +0000 (UTC)
28Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1])
29 by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D0B0528871
30 for <patchwork-linux-kbuild@patchwork.kernel.org>;
31 Tue, 9 Jul 2019 18:49:26 +0000 (UTC)
32Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486)
33 id C0AE028874; Tue, 9 Jul 2019 18:49:26 +0000 (UTC)
34X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on
35 pdx-wl-mail.web.codeaurora.org
36X-Spam-Level:
37X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI,
38 RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1
39Received: from vger.kernel.org (vger.kernel.org [209.132.180.67])
40 by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5F01228871
41 for <patchwork-linux-kbuild@patchwork.kernel.org>;
42 Tue, 9 Jul 2019 18:49:26 +0000 (UTC)
43Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
44 id S1727063AbfGIStZ (ORCPT
45 <rfc822;patchwork-linux-kbuild@patchwork.kernel.org>);
46 Tue, 9 Jul 2019 14:49:25 -0400
47Received: from youngberry.canonical.com ([91.189.89.112]:56934 "EHLO
48 youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
49 with ESMTP id S1726133AbfGIStY (ORCPT
50 <rfc822;linux-kbuild@vger.kernel.org>);
51 Tue, 9 Jul 2019 14:49:24 -0400
52Received: from mail-io1-f69.google.com ([209.85.166.69])
53 by youngberry.canonical.com with esmtps
54 (TLS1.0:RSA_AES_128_CBC_SHA1:16)
55 (Exim 4.76)
56 (envelope-from <seth.forshee@canonical.com>)
57 id 1hkvB4-0006CP-8Q
58 for linux-kbuild@vger.kernel.org; Tue, 09 Jul 2019 18:49:22 +0000
59Received: by mail-io1-f69.google.com with SMTP id f22so24034402ioj.9
60 for <linux-kbuild@vger.kernel.org>;
61 Tue, 09 Jul 2019 11:49:22 -0700 (PDT)
62X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
63 d=1e100.net; s=20161025;
64 h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version
65 :content-transfer-encoding;
66 bh=PxPSNMyhSc6n3DVu8+8initQj1WYg71cqa7Dt37YRsc=;
67 b=qHbylZ43xDRjDzcyh6+tvI1FHfj4WWHEfu1q+lcIS5ZnHVkD+Kbs8AvvnQbbzxW/NR
68 G5bnmNRaECN8JpHIl04cEI7ac7X80G/RsTvZqaUhHIcipFo9G//4rbS6wNQXfykAT3s5
69 4Hisn0RwUl/P8ih0rv6GpSKQ42sePwKiFDn1OB/IA5yfeRnBdMX/Yz9fa8WZw5WcyKrx
70 QbHW2Sbh4a+KtOUdW4077l90jaFdGYK0jCi2cbxYZaLaUqlGp7sGOdeCkL0kH04J5Xc+
71 OBSB1sPYyMeJnzD9zgEyFrWZhVqRzutyx8+h6ED5lutxRxcUrJZTcN0t92zjaT7PUK3M
72 6+Cw==
73X-Gm-Message-State: APjAAAV4mJS0j+NGxACnw/Q7oaf1hS+0yO8jvXFLrfIEZr2fl43yGiC5
74 iqZe/xI2zc/WW4hGVu4k4R0nB7XEWLM7muvOK/0zpYsskk7IUOTlyEDFjiMgPSrKYhwVIEpUEAr
75 Rt4W8ClWJWmC7rMIlFISjq8AY8E7Vj6mrgybzttx8sg==
76X-Received: by 2002:a02:cc50:: with SMTP id i16mr3728956jaq.50.1562698161275;
77 Tue, 09 Jul 2019 11:49:21 -0700 (PDT)
78X-Google-Smtp-Source:
79 APXvYqww71No87FKb3rA8fwT+GlZqF9MtRtPIDfWtG04OMqHpUZRPq3+YiRqWPLQiJMSyPtIx7hDRg==
80X-Received: by 2002:a02:cc50:: with SMTP id i16mr3728928jaq.50.1562698160978;
81 Tue, 09 Jul 2019 11:49:20 -0700 (PDT)
82Received: from localhost ([2605:a601:ac2:fb20:b0e0:a018:77ee:9817])
83 by smtp.gmail.com with ESMTPSA id
84 n17sm20052182iog.63.2019.07.09.11.49.20
85 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256);
86 Tue, 09 Jul 2019 11:49:20 -0700 (PDT)
87From: Seth Forshee <seth.forshee@canonical.com>
88To: Masahiro Yamada <yamada.masahiro@socionext.com>,
89 Michal Marek <michal.lkml@markovi.net>
90Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org
91Subject: [PATCH] kbuild: add -fcf-protection=none to retpoline flags
92Date: Tue, 9 Jul 2019 13:49:19 -0500
93Message-Id: <20190709184919.20178-1-seth.forshee@canonical.com>
94X-Mailer: git-send-email 2.20.1
95MIME-Version: 1.0
96Sender: linux-kbuild-owner@vger.kernel.org
97Precedence: bulk
98List-ID: <linux-kbuild.vger.kernel.org>
99X-Mailing-List: linux-kbuild@vger.kernel.org
100X-Virus-Scanned: ClamAV using ClamSMTP
101
102-mindirect-branch and -fcf-protection are not compatible, and
103so kernel builds fail with a gcc build where -fcf-protection is
104enabled by default. Add -fcf-protection=none to the retpoline
105flags to fix this.
106
107Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
108---
109 Makefile | 4 ++++
110 1 file changed, 4 insertions(+)
111
112diff --git a/Makefile b/Makefile
113index 3e4868a6498b..050f11d19777 100644
114--- a/Makefile
115+++ b/Makefile
116@@ -636,6 +636,10 @@ RETPOLINE_CFLAGS_CLANG := -mretpoline-external-thunk
117 RETPOLINE_VDSO_CFLAGS_CLANG := -mretpoline
118 RETPOLINE_CFLAGS := $(call cc-option,$(RETPOLINE_CFLAGS_GCC),$(call cc-option,$(RETPOLINE_CFLAGS_CLANG)))
119 RETPOLINE_VDSO_CFLAGS := $(call cc-option,$(RETPOLINE_VDSO_CFLAGS_GCC),$(call cc-option,$(RETPOLINE_VDSO_CFLAGS_CLANG)))
120+# -mindirect-branch is incompatible with -fcf-protection, so ensure the
121+# latter is disabled
122+RETPOLINE_CFLAGS += $(call cc-option,-fcf-protection=none,)
123+RETPOLINE_VDSO_CFLAGS += $(call cc-option,-fcf-protection=none,)
124 export RETPOLINE_CFLAGS
125 export RETPOLINE_VDSO_CFLAGS
126