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)) From patchwork Fri Apr 1 20:19:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sami Tolvanen X-Patchwork-Id: 12798778 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 9601FC433EF for ; Fri, 1 Apr 2022 20:40:40 +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=n4of7ZLHk+ZofgHW0TPFmm8tBJn9CJNuNf00Pw0Tw+Y=; b=LEW4vZo71JmgHExs9eggjULDAu T9pbvH94PbIKPoQn5RXbDNk7aSN0iLIDCFpTyrGZqPCkd5ZGIPjSAMf2WRLbHb+xZ3HXc47D0BrfV UxIJNIx+ZXmc92PsI1HaDT90Ta4oVBfJvB0ZKqdfZ6p3CrLgv9txLKSnzla3hwV7tTeQ7VlMw7Ucs p8IOaQ1aAbGa3jhXQWQMf4cR2u+OP9i1KS821EXcGncvDlbGKuRrMpGPnJK4dMB1GcDfYSAUBI/0u IzB2NL88EXpuIJowC9qdpy29JPaY6pMympBoaqEOqTDD5HMYvtxJobRlhplVaxnm+v/Q/a+DTlPAG NShryKbw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1naO3G-007FHD-19; Fri, 01 Apr 2022 20:39:22 +0000 Received: from mail-yw1-x1149.google.com ([2607:f8b0:4864:20::1149]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1naNk0-0075cR-1D for linux-arm-kernel@lists.infradead.org; Fri, 01 Apr 2022 20:19:29 +0000 Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-2e8216c4c46so35203607b3.23 for ; Fri, 01 Apr 2022 13:19:24 -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; bh=ATcdLAiyB0HmFVQDg4Xl7rvZSmepnr+daM3v/Y+LeMI=; b=EoyjCfGV3FCQpOkbXV+W3kTnXGO1Evzvf/ZY38A9M1NFlrIqtx1VS6qnTsGBd7BwjX WoMjEr/RMAn4q8VmBMj6mKCCSJYHInMMKdfBk6wZQvwoBizwF+NZ8BoF/h/iCTmyVqoC G7HNo6/dYJ2gtGhM3NTwMeNao+r+TProu7GExptuAVxeL/kk3ZIkTTOekXFAtNjuD2NU ma1hWOS5qp5Duz30EY9BFcZJwxIWP8vW/FC5lCWqXj8YNzw5RVfVB8q0U357R2cNp4mw hIbFGaH0dJMNrmMTAzN7dJIn2fB0mcgwx8f4VQjnqYm/fpUcfe0YQqEExQvrwoLFRu3/ Rs/g== 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; bh=ATcdLAiyB0HmFVQDg4Xl7rvZSmepnr+daM3v/Y+LeMI=; b=ohqyNxfrSvyMhxwwJDCNtpH5H58z9tV8AhrvyNZR5Q3wltBSFuEj7x0yaPBUyClEhg k+Y9doPsBAVqS9MuMHz3PLIWwga/uzmZ9f8Xz+t6y41+4t38JjFqKDIhzqSuquyLTVDN 7WblEz/owoswGdi+Q7+aKM2efOww53CpNYUTcjVdgVOJ/7qRljkhfzHaygti05EF9o7M qmJo4Lc4eRaJrksrl9xA/UVvZ8DLk5MuwRpCLbs8ytWPSe7l76uSg1HEmqAErDJsckNb /WJl613TSYI74SNrfeFsDBt7Vd86Bb6LyqH3Aj414hBqdH8247ACZHYUHhVatDRFMtFx vtuA== X-Gm-Message-State: AOAM5312fK7/ZgDQcGNaQzNN1+x0jaXls9NIlWDL1gAYizbIlch0V2SU q4aOOpV67BZTq3zIrZcIin3rCa7A30CsmduYJT4= X-Google-Smtp-Source: ABdhPJyew2kq+WRmdfIe6euP7IdAfz4Lf1J4a3hpbhDfzorQRebEdIXVNDbDfQueKfPJDVocv/gDvOOrkxzODDApak4= X-Received: from samitolvanen1.mtv.corp.google.com ([2620:15c:201:2:ebe8:1acf:913c:f19e]) (user=samitolvanen job=sendgmr) by 2002:a5b:90a:0:b0:634:15f3:871b with SMTP id a10-20020a5b090a000000b0063415f3871bmr10173555ybq.306.1648844363642; Fri, 01 Apr 2022 13:19:23 -0700 (PDT) Date: Fri, 1 Apr 2022 13:19:15 -0700 In-Reply-To: <20220401201916.1487500-1-samitolvanen@google.com> Message-Id: <20220401201916.1487500-3-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=1056; h=from:subject; bh=TxU5yU7eF6HnJJtCowWe9icJOHczcBwSXoiV/s/cDrI=; b=owEB7QES/pANAwAKAUy19oSLvFbuAcsmYgBiR15CugMAC3++WEpyG4vENztHvLXakUUYXOQsyeYl rVPXFE2JAbMEAAEKAB0WIQQ1zPtjsoPW0663g5RMtfaEi7xW7gUCYkdeQgAKCRBMtfaEi7xW7gliC/ 9FfQ7TZrKMqndhgdzS0eK9T5tspAJnIZpf3oeBTdH1yAeQIwZvHzFf76rSoqV6LrbI+gqMeIdHKr08 UIVlKWpl6xs1zdEc+NvkBalo7cGuCVrQhcVyGSCHyr4qFrtFKg3hA4cA134xfBCef2dRq4OlcjlxyW noFvvInv0CUwZj+cCNYqM5+PjO39zKKvvYF0L6VlWVNn7Fa3UCbymDa6AcmA7O6TO7t+SExVQ1nE8W vTxJKJBAKAt1rgs3KjEFPVgalAUFnfhfNCCPeh/SC6LF5++tnbSJCjTFzzpyehcjyrrPscjSrGh7yZ pwQxCsuHKH3E7frUwQXCr1167ogQen62ZBUZKyJA3stmJfOtSXlUGXDLPyuNpWNM5SiuQxTE3I9b01 ptlVlMGTab3Tl/kHLSb2PvyQA2hVbrgske+Vc7c0KZGmn1zs1kS+LUgKIU9z5d0Hu0XyCrg3psuddv BDIDadUv7bfb+ZZXkjWwR/kblPiEkSPZWT/MZkK6KiBf0= X-Mailer: git-send-email 2.35.0 Subject: [PATCH 2/3] linux/compiler-clang.h: define function_nocfi 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_131928_127244_4ABD5E7E X-CRM114-Status: GOOD ( 11.08 ) 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 Use __builtin_function_start() to implement the function_nocfi() macro when CONFIG_CFI_CLANG is selected. Signed-off-by: Sami Tolvanen --- include/linux/compiler-clang.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/linux/compiler-clang.h b/include/linux/compiler-clang.h index babb1347148c..c84fec767445 100644 --- a/include/linux/compiler-clang.h +++ b/include/linux/compiler-clang.h @@ -69,6 +69,16 @@ #define __nocfi __attribute__((__no_sanitize__("cfi"))) #define __cficanonical __attribute__((__cfi_canonical_jump_table__)) +#if defined(CONFIG_CFI_CLANG) +/* + * With CONFIG_CFI_CLANG, the compiler replaces function address + * references with the address of the function's CFI jump table + * entry. The function_nocfi macro always returns the address of the + * actual function instead. + */ +#define function_nocfi(x) __builtin_function_start(x) +#endif + /* * Turn individual warnings and errors on and off locally, depending * on version. From patchwork Fri Apr 1 20:19:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sami Tolvanen X-Patchwork-Id: 12798777 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 B5A2EC433F5 for ; Fri, 1 Apr 2022 20:39:55 +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=hl77eSh7RpJflro/XJ1g8a0/5RXbHtKJ+UyQaiQNXvk=; b=i1gYy2PjkOjjJcOvXI2XiiTTLi WxRTam/+NPp2UabkqoHqAs1ip8Q6mdlnbVag/ihVqjrfS87B0VZNykcxlZ1tiyO6SouqYBNEnImtn 4KKZemro7FZ6KugSgGqJUQt+qWxuhkN18iVCWnwGFm48kr2HH6BJbQrMVZ9tQ/U1cQiuqxg2R7VtT K63aJu0NaYOaiXOD+w0/IInfCZMBQbCCuwO53PSbKuBKyFQw95vWklpbhL5+MekjXvNfUYMZGR2cM KM/USyk6Tw6yzkXB98E+l1dRN0HVCA19g/7YUdYSd9NwxX263WAv5HJ1iDgen3dFYMCRWcawX/gnf +/tQkHkg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1naO2b-007Exc-Bk; Fri, 01 Apr 2022 20:38:42 +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 1naNjz-0075eA-Hd for linux-arm-kernel@lists.infradead.org; Fri, 01 Apr 2022 20:19:29 +0000 Received: by mail-yb1-xb4a.google.com with SMTP id x9-20020a5b0809000000b00631d9edfb96so3005280ybp.22 for ; Fri, 01 Apr 2022 13:19:26 -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; bh=0tGuel8F0TPZ4i19LuuPjmtXqje2ywWglhe/oIdo5VQ=; b=DvT1jTf5TrMmdo+R/peAXWEcfaqI0CTKicq9NuxiQwsvogqT0Q7+PBVGIhAGw7TCNy XA1nEIo1hupZyhsJi7y7q+P4m0gAF8th3hcbD65r/heuupKFyJDtGA12HtiIjbdav1ey sVWYyVhWomxLYHu+i7sugSFeoTNYJEOmyG5m6bTQ6seZzFdlEpk1qzvgrstj0l0TVQFF tN9WCc0YVeZxkyot8V/nyOPv5ANKSaRz7nai4h+sm6dg0N6lPkfTE3H3tlzoPg1I9Rpn uWDSC6HUsm6sS1p7G+wlB+eFzpwqTg/wqs6qP7IZwULuwoda474t5/bUAv5m+YSl1wVs lrMA== 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; bh=0tGuel8F0TPZ4i19LuuPjmtXqje2ywWglhe/oIdo5VQ=; b=OHddRjr+w+MIQrv63QIFaAMpMthETrE2O/FXqPCDI4cVSzXhx4G2HHGCOIPu5d25WY zuFMOeKq+PtjQ0QKTKfSttctfE5O9K/xkYJD2GjwsRo3+lwClqkUwTgZHG6LFDsSrhwv mDqukyyaNNDNSNPLsWYJXzVuuLA1P+fhcxlm4/qsKHN6oA4D7E8LFMnu+5MOAGT8el7t AYoB4yLPxVhtBFntoOeNva3FkfnpZdNJDbvOnlZma/P38rrinYL+5sQxCs7ujV+JXz47 L4p/RaBQBnrrv7NEis5gkMQ1IucFRs1eUqDAKjutPAL44z4VlgHg06J7qMi3ZHNZkGq0 hbhQ== X-Gm-Message-State: AOAM533gT1EmHuVFF6FO00ploHwBYcvey5PWIsXbwX3Zk3YulV/aWUOc /Faa/7lp+FVxyjKU+r6ScLHxkK9pHP50MQyJEoY= X-Google-Smtp-Source: ABdhPJyczPJlHMZJ5SsOuDzCQ5Zx+moZV8jK12RncbXJNK4fa4a+uQlY5m3JXXqTHzfRGUCmkCBHysLhBLexKAAxzfU= X-Received: from samitolvanen1.mtv.corp.google.com ([2620:15c:201:2:ebe8:1acf:913c:f19e]) (user=samitolvanen job=sendgmr) by 2002:a05:6902:1546:b0:63b:7960:ca83 with SMTP id r6-20020a056902154600b0063b7960ca83mr10524407ybu.52.1648844366067; Fri, 01 Apr 2022 13:19:26 -0700 (PDT) Date: Fri, 1 Apr 2022 13:19:16 -0700 In-Reply-To: <20220401201916.1487500-1-samitolvanen@google.com> Message-Id: <20220401201916.1487500-4-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=1278; h=from:subject; bh=NtSOtkaS5YpGAma/5363kop1E6xEpoqT3+yVgUVR148=; b=owEB7QES/pANAwAKAUy19oSLvFbuAcsmYgBiR15Duaw2orP2Ch7LgRIVD7zbYKWzx4lyqqoSUycA 4hFov6yJAbMEAAEKAB0WIQQ1zPtjsoPW0663g5RMtfaEi7xW7gUCYkdeQwAKCRBMtfaEi7xW7kgxC/ 94YUjQ86qg2QNFo0zOZpLNhNoZrYE9N6UoYuptrK2s5ExRrYLkKkCJoTnZNYg0eD7UR34ThbeM4glC bbR7KAIpU4pqZdu44ILdIuLEloNjk8r8i73R/bhhkGEL3DIwo/9qH0kSgPuP7DEN+IKySjZ97vyS1z NyepXAChV+OV4sD49Id45jxlRHS5iSZdqpYbxBAulqyymOJq33VhikVIpQkJYEwNqyXhNVoLm42hc8 Oxo6tsOZhVOPg3XajU/BUx3V/Em7l2Nn31FA/kc0g58a4tBA6JdFV2WjVKUysyRkoL6X0PthHKB09I wrp0dKq+MSBAbBfCz/OSVubvE9y0n1Lk+HjUqw8GoGvbbETpcUKMLIzlGucOC6W1bvqy+50alyII+c T84eYNyRKv1EoVYra6OF4ul6fnhwOsGJ54+HHdXF81AiQD3jDyKVI/0ZiOYm8KYfa1FSKYzdmfoIby tfiURTStJhv2wmBp9Mpjwe7Qbno/3uqLiRsfcLEBiWiPQ= X-Mailer: git-send-email 2.35.0 Subject: [PATCH 3/3] arm64: Drop the inline assembly implementation of function_nocfi 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_131927_632442_DF8A18A3 X-CRM114-Status: GOOD ( 11.74 ) 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 Drop the inline assembly version of function_nocfi() now that CONFIG_CFI_CLANG depends on __builtin_function_start(), which allows this macro to be implemented more cleanly and in a way that works also with static initializers. Signed-off-by: Sami Tolvanen Acked-by: Will Deacon Reviewed-by: Mark Rutland Tested-by: Mark Rutland --- arch/arm64/include/asm/compiler.h | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/arch/arm64/include/asm/compiler.h b/arch/arm64/include/asm/compiler.h index dc3ea4080e2e..6fb2e6bcc392 100644 --- a/arch/arm64/include/asm/compiler.h +++ b/arch/arm64/include/asm/compiler.h @@ -23,20 +23,4 @@ #define __builtin_return_address(val) \ (void *)(ptrauth_clear_pac((unsigned long)__builtin_return_address(val))) -#ifdef CONFIG_CFI_CLANG -/* - * With CONFIG_CFI_CLANG, the compiler replaces function address - * references with the address of the function's CFI jump table - * entry. The function_nocfi macro always returns the address of the - * actual function instead. - */ -#define function_nocfi(x) ({ \ - void *addr; \ - asm("adrp %0, " __stringify(x) "\n\t" \ - "add %0, %0, :lo12:" __stringify(x) \ - : "=r" (addr)); \ - addr; \ -}) -#endif - #endif /* __ASM_COMPILER_H */