From patchwork Fri Apr 1 20:19:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sami Tolvanen X-Patchwork-Id: 12798776 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 48D01C433F5 for ; Fri, 1 Apr 2022 20:39:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:From:Subject:References: Mime-Version:Message-Id:In-Reply-To:Date:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=hPrr1fQTDPy4MqcLai5L4/ImEX/9AYyBmSRxCK034sc=; b=ByOTu5JvoDhcSFcSOqaw+sesLU PKj93Tlf8hjP2fVSYoQJGYQQ9goVg7q4lAbNW2QieY1ltkh2eP8+MqB+DWQPafLr7fHqINPVvICzo Aj8vgTd20Dpg17sHpZcFzoGQB+hDy43F2WfTdmZ/uyGDMqD9+cQuVgv8O8fy/318XkL3VKgiYamHE /Hj5FZhmAC13rGwFA9rTd8eindL+NYIIEhYEAJlx3trCkrvpxOuaQMTPwGGTzUvkkv1IWRr8RfxNq UDw4nj5RzWrCBGd10wm1Vn8FpQJKpNBnp87H+lNG6Eh2uVC3PFSrp4l+3C6LRedepenvN3m2MXoJB S3XLwAQQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1naO1y-007Eig-T6; Fri, 01 Apr 2022 20:38:03 +0000 Received: from mail-yb1-xb4a.google.com ([2607:f8b0:4864:20::b4a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1naNjw-0075al-87 for linux-arm-kernel@lists.infradead.org; Fri, 01 Apr 2022 20:19:25 +0000 Received: by mail-yb1-xb4a.google.com with SMTP id f139-20020a253891000000b0063d92dcd56dso167891yba.11 for ; Fri, 01 Apr 2022 13:19:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc:content-transfer-encoding; bh=/q7CSXnA5KcPyL6yvbN6hU0mEK4VcrEfa9P7QXrPsno=; b=MiUIX6Azw4gtG61M0EgrFRKBvKyEQG/EVx3WfKgmJCOI1WbmZ3eVKWqXHsyJQizrwO USaqcbRG7X4MWf/4x5Ve8SrkgTr/4V2UhQq3N2IQIMVdXHwNBnNAm2md2xBbdiT2Or5i NArObT1io+WzbF1BzSRhOSHleYpxWaYGeh5J662TxIu/K7csviLub03/q2ALUH1dXwOD Jl2v0JTgK+Q1pKSweNXTYQNT267O7Y2usHG8mfxwatq/qiIYsfbMIxAPJJG/YmJwjp8/ 5mKaqSQNCOUhwgnL0G+iZqwgO/GywEELBAMnyqunFHlcgc1DJVMqgY1dilqcYoQtv5W+ UQTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc:content-transfer-encoding; bh=/q7CSXnA5KcPyL6yvbN6hU0mEK4VcrEfa9P7QXrPsno=; b=BMjGRM4JR4A85HAPG/1rrfEEziK/x3UbDhEqI4E0ZBenYCFlgwJabvzL7ZoHz5IjCc bhXPRFzaLuLlO4x+cZDVaoBTWXgjP8sI5EyxMN0+jRZ8HSdwyd4EKlgZ+QPWPsRsX6d8 JxqdUNC34EiUmx3Gh7DaBVQCxeQJ7gpJOq3SWseaDqca6dW6z32eoYN5OzMxx67pZQ8O FF1rt3Z6do1EYwxlwsLH4lSu1X6fhJ+XAJKrG9Pvb/Q4Y1tj0AcVLfHo769miV1h94o3 lcULo5AMbqQVt5D4ZK2dSr43+LabUy8Ki3BbgCsHnBGX4vgcnZFGlOWnzoNewHQsxAcS yFQg== X-Gm-Message-State: AOAM533hWdUmGznT4bexX2vW01GRkcaC3S9NkcnhhqvgkGSqpYzlDWNv cFpslbnORV9kJHN35Z29rZA0H4jBrenpbExJtGs= X-Google-Smtp-Source: ABdhPJw1ufmCshm6xs5eFuvDkNHp0Doc5sHO9vZ7rTZ1C8L0VyRYzptcT0FB0O89vN84xvPmEeWDU2ZW5AP0eMggI8c= X-Received: from samitolvanen1.mtv.corp.google.com ([2620:15c:201:2:ebe8:1acf:913c:f19e]) (user=samitolvanen job=sendgmr) by 2002:a05:6902:150b:b0:639:f81:8179 with SMTP id q11-20020a056902150b00b006390f818179mr10164917ybu.31.1648844361283; Fri, 01 Apr 2022 13:19:21 -0700 (PDT) Date: Fri, 1 Apr 2022 13:19:14 -0700 In-Reply-To: <20220401201916.1487500-1-samitolvanen@google.com> Message-Id: <20220401201916.1487500-2-samitolvanen@google.com> Mime-Version: 1.0 References: <20220401201916.1487500-1-samitolvanen@google.com> X-Developer-Key: i=samitolvanen@google.com; a=openpgp; fpr=35CCFB63B283D6D3AEB783944CB5F6848BBC56EE X-Developer-Signature: v=1; a=openpgp-sha256; l=1684; h=from:subject; bh=7zO5jJOOB5O810+rUoHeiZO9VlITzF/f1cuVxYGtJV0=; b=owEB7QES/pANAwAKAUy19oSLvFbuAcsmYgBiR15CwOu77U++A+3akTihXXW47Ey1dwrsZdUhek8n HbC7HU+JAbMEAAEKAB0WIQQ1zPtjsoPW0663g5RMtfaEi7xW7gUCYkdeQgAKCRBMtfaEi7xW7jNgC/ 9u4/tNF4JQ7D+noTqrl303CNHQm8GorY6FyAjWC07rJJryaMuFL93yb4bU75GxFtKpxj/fYIaSRV+X wS6AXBxfZQV6xonkBpPqmByjTDCB/eDPaoMPmqUkR6nmVE6lBybl2qQVu4UzjyV7SBwJI6CGxsM9cO K+CdjLl1ipQ+Xo+8OZ/t9jmcJsRCFRZxYv3oxFqZTVedEUxIMw01FsL0jQA/k1SYp9FCPwdMf5rDc/ zCB8uqtggLCeBngSQ9wQlRpgnWxPt5lRvHO9UjTMUahmckUN+3F1FtKKVJYldjNtyAuXnpj21iZa9U ij3720OXjljPinXx1V7PMtX/wRkF8jvCX2jwyCLDKPpJQlGH+2yhDfSEoIcKlG9MWKB3m2k5hKh9pS wdaRKf5xbLUm3xS1j57Wlaeaei7EHSYPqj1WqVK0/svo+rz3g8XdXDfRHdhTbcqWvudqz1GYwMraNs klzsxlsrlC9LFSbv6jPvlcUA0QsjcyKwKpwZ3jgK1mn24= X-Mailer: git-send-email 2.35.0 Subject: [PATCH 1/3] kbuild: Change CFI_CLANG to depend on __builtin_function_start From: Sami Tolvanen To: Kees Cook Cc: Catalin Marinas , Mark Rutland , Masahiro Yamada , Nathan Chancellor , Nick Desaulniers , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, Sami Tolvanen X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220401_131924_348868_8468981F X-CRM114-Status: GOOD ( 12.64 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Clang 14 added support for the __builtin_function_start() built-in function, which allows us to implement function_nocfi() without architecture-specific inline assembly. This patch changes CONFIG_CFI_CLANG to depend on the built-in and effectively upgrades the minimum supported compiler version for CFI to Clang 14. Signed-off-by: Sami Tolvanen --- arch/Kconfig | 5 +---- init/Kconfig | 3 +++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/Kconfig b/arch/Kconfig index 29b0167c088b..eecfc2809781 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -723,10 +723,7 @@ config ARCH_SUPPORTS_CFI_CLANG config CFI_CLANG bool "Use Clang's Control Flow Integrity (CFI)" depends on LTO_CLANG && ARCH_SUPPORTS_CFI_CLANG - # Clang >= 12: - # - https://bugs.llvm.org/show_bug.cgi?id=46258 - # - https://bugs.llvm.org/show_bug.cgi?id=47479 - depends on CLANG_VERSION >= 120000 + depends on CC_HAS_BUILTIN_FUNCTION_START select KALLSYMS help This option enables Clang’s forward-edge Control Flow Integrity diff --git a/init/Kconfig b/init/Kconfig index ddcbefe535e9..f024fd353373 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -86,6 +86,9 @@ config CC_HAS_ASM_INLINE config CC_HAS_NO_PROFILE_FN_ATTR def_bool $(success,echo '__attribute__((no_profile_instrument_function)) int x();' | $(CC) -x c - -c -o /dev/null -Werror) +config CC_HAS_BUILTIN_FUNCTION_START + def_bool $(success,echo 'void f(void) {}; void *p = __builtin_function_start(f);' | $(CC) -x c - -c -o /dev/null) + config PAHOLE_VERSION int default $(shell,$(srctree)/scripts/pahole-version.sh $(PAHOLE))