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 */