From patchwork Mon Sep 16 13:41:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Seth Forshee X-Patchwork-Id: 1162818 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46X6qS10S8z9sR6; Mon, 16 Sep 2019 23:42:11 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1i9rGa-00059P-3j; Mon, 16 Sep 2019 13:42:08 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1i9rGY-00058L-Ll for kernel-team@lists.ubuntu.com; Mon, 16 Sep 2019 13:42:06 +0000 Received: from mail-wm1-f72.google.com ([209.85.128.72]) by youngberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1i9rGY-0003cN-Dq for kernel-team@lists.ubuntu.com; Mon, 16 Sep 2019 13:42:06 +0000 Received: by mail-wm1-f72.google.com with SMTP id r187so31168wme.0 for ; Mon, 16 Sep 2019 06:42:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=BBpH9BbXAD4ZN6QE2SUhuwIfRfAuGTeRcTm72MKZ/AE=; b=jjIelwHoxFGGpgt2uU2D5SXDNhDCX57jaAvVlgBisyehqJKRFdc0Pmub6M0FJbZXTF Cb2PQCEmcxbm0Q1lUKcBg860NXLzdqgq8gERiiGaWLtjuKS+dKexRCbXE+g+co6uliex /U6Ojvzo5mR1POZjgjAmwh4ofVbJNh2PWLs5EWFXQlcbpLUIS3JW3HgwDfdgp5x/+SCK RUaLcCVlPKy0o1zoMktlkYEyO8v7wNvvXgAlq/eQ11clNQZ1YkUp7/bRxgeN+JCPAsMM daR0lv51RQ7rz9PrxeLkYjbUomWmFjvmerqlryqC/FY5EVETFr4jAX9xVzTHYL9MQHvm 4eJw== X-Gm-Message-State: APjAAAUanShM8hz//dBrPf4j/hjCN1L2xU+X6PaSNhVP8dt3vXHs/9ub X7fTdH7RWhAx+5zje/8UCF2nKV1ZaT+sQdKeLyyDkSu34QaCW6Qj+8B3UMXZMlczbQ8MY1W1FB5 BxBiYzOpYoUetda3hNdI7G17kfpKHEIqc16PyTf7ZYQ== X-Received: by 2002:adf:bb0a:: with SMTP id r10mr37968540wrg.13.1568641325882; Mon, 16 Sep 2019 06:42:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqyt3sBBPkIeN/gMHTO4pMv2Y9eh/0TzJBwziS9CQJUo/Cmv7M9wN7Al3c3AOErGkBqK5geaBA== X-Received: by 2002:adf:bb0a:: with SMTP id r10mr37968524wrg.13.1568641325660; Mon, 16 Sep 2019 06:42:05 -0700 (PDT) Received: from localhost (us.sesame.canonical.com. [91.189.91.19]) by smtp.gmail.com with ESMTPSA id a205sm24888593wmd.44.2019.09.16.06.42.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Sep 2019 06:42:05 -0700 (PDT) From: Seth Forshee To: kernel-team@lists.ubuntu.com Subject: [PATCH 1/1][SRU][D] UBUNTU: SAUCE: kbuild: add -fcf-protection=none when using retpoline flags Date: Mon, 16 Sep 2019 15:41:56 +0200 Message-Id: <20190916134157.32219-2-seth.forshee@canonical.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190916134157.32219-1-seth.forshee@canonical.com> References: <20190916134157.32219-1-seth.forshee@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" BugLink: https://bugs.launchpad.net/bugs/1843291 The gcc -fcf-protection=branch option is not compatible with -mindirect-branch=thunk-extern. The latter is used when CONFIG_RETPOLINE is selected, and this will fail to build with a gcc which has -fcf-protection=branch enabled by default. Adding -fcf-protection=none when building with retpoline enabled prevents such build failures. Signed-off-by: Seth Forshee Signed-off-by: Masahiro Yamada (cherry picked from commit 29be86d7f9cb18df4123f309ac7857570513e8bc) Signed-off-by: Seth Forshee --- Makefile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Makefile b/Makefile index 4c249a80dd17..d1e762787f5c 100644 --- a/Makefile +++ b/Makefile @@ -885,6 +885,12 @@ KBUILD_CFLAGS += $(call cc-option,-Werror=designated-init) # 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 + # use the deterministic mode of AR if available KBUILD_ARFLAGS := $(call ar-option,D) From patchwork Mon Sep 16 13:41:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Seth Forshee X-Patchwork-Id: 1162820 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46X6qY2lbXz9sRC; Mon, 16 Sep 2019 23:42:17 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1i9rGf-0005Dd-DG; Mon, 16 Sep 2019 13:42:13 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1i9rGd-0005C9-FV for kernel-team@lists.ubuntu.com; Mon, 16 Sep 2019 13:42:11 +0000 Received: from mail-wm1-f72.google.com ([209.85.128.72]) by youngberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1i9rGd-0003ce-6O for kernel-team@lists.ubuntu.com; Mon, 16 Sep 2019 13:42:11 +0000 Received: by mail-wm1-f72.google.com with SMTP id h6so37570wmb.2 for ; Mon, 16 Sep 2019 06:42:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=whL/dMgBByS3MlJmGbPbolexNdb9G3LDzPrEcf5zmFU=; b=Po8EuQ7IsbQDK0K9Ns7GVAjbuCm3roUG9vSiovKbha+uqDra3LmUXkrOoCubzg6c/C gB4ucPtMBoPe8IKATQ9HKyNr+gPm376cAeKMVZAlgxLDkGT+aKXsdwj/COReeMAr9FYe /t1obemPewIaHbXtO0Pzp0bMcvgwXXtoXReJvAItT0MtNpEadjsSBcj5Hkm9ieAofuzp LKNaTBxe/p81knp8kjnXIQRDx6IGaXR2q0AfVmYYxZfIQPfln+Yfh1AqsuIofuIBNLMM IqU0SDPhwp6RhPkzOorWYTZUf6nNnyEMZwfj+5zVjBtZqtGVXN5WdUxED8abpKZrWND4 jv2Q== X-Gm-Message-State: APjAAAUaTrew0gc16Ma5TsOXsKHwwv81vNr/U8DlZMfm3QWD6FYgyL4k Q+k1tkEPQer23yLIpkgNacj09NQERYh+UJ2UixY9LbSIGKVcm7xydT+s0nTpWWnpUcylhttB16Y p5pi3ouN5TKW6FQRl6dDFq6lHuGJN2jU9/5hmgFd+DQ== X-Received: by 2002:a1c:4108:: with SMTP id o8mr14886452wma.129.1568641330651; Mon, 16 Sep 2019 06:42:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqzJBJOQn2uOWT9GWiuoztmskdbiTBL/vimtd1QdUZGeXPB3NY8R5MAsLn+qCP5XWF3hNcgUzg== X-Received: by 2002:a1c:4108:: with SMTP id o8mr14886436wma.129.1568641330415; Mon, 16 Sep 2019 06:42:10 -0700 (PDT) Received: from localhost (us.sesame.canonical.com. [91.189.91.19]) by smtp.gmail.com with ESMTPSA id w8sm89788wmc.1.2019.09.16.06.42.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Sep 2019 06:42:09 -0700 (PDT) From: Seth Forshee To: kernel-team@lists.ubuntu.com Subject: [PATCH 2/2][SRU][B] UBUNTU: SAUCE: kbuild: add -fcf-protection=none when using retpoline flags Date: Mon, 16 Sep 2019 15:41:57 +0200 Message-Id: <20190916134157.32219-3-seth.forshee@canonical.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190916134157.32219-1-seth.forshee@canonical.com> References: <20190916134157.32219-1-seth.forshee@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" BugLink: https://bugs.launchpad.net/bugs/1843291 The gcc -fcf-protection=branch option is not compatible with -mindirect-branch=thunk-extern. The latter is used when CONFIG_RETPOLINE is selected, and this will fail to build with a gcc which has -fcf-protection=branch enabled by default. Adding -fcf-protection=none when building with retpoline enabled prevents such build failures. Signed-off-by: Seth Forshee Signed-off-by: Masahiro Yamada (cherry picked from commit 29be86d7f9cb18df4123f309ac7857570513e8bc) Signed-off-by: Seth Forshee --- Makefile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Makefile b/Makefile index c78f3d71a905..1fe5d2a2cfd9 100644 --- a/Makefile +++ b/Makefile @@ -869,6 +869,12 @@ KBUILD_CFLAGS += $(call cc-option,-Werror=incompatible-pointer-types) # Require designated initializers for all marked structures KBUILD_CFLAGS += $(call cc-option,-Werror=designated-init) +# 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 + # use the deterministic mode of AR if available KBUILD_ARFLAGS := $(call ar-option,D)