linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sami Tolvanen <samitolvanen@google.com>
To: Kees Cook <keescook@chromium.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Masahiro Yamada <masahiroy@kernel.org>,
	Nathan Chancellor <nathan@kernel.org>,
	Nick Desaulniers <ndesaulniers@google.com>,
	Will Deacon <will@kernel.org>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, llvm@lists.linux.dev,
	Sami Tolvanen <samitolvanen@google.com>
Subject: [PATCH 3/3] arm64: Drop the inline assembly implementation of function_nocfi
Date: Fri,  1 Apr 2022 13:19:16 -0700	[thread overview]
Message-ID: <20220401201916.1487500-4-samitolvanen@google.com> (raw)
In-Reply-To: <20220401201916.1487500-1-samitolvanen@google.com>

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 <samitolvanen@google.com>
---
 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 */
-- 
2.35.0


  parent reply	other threads:[~2022-04-01 20:22 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-01 20:19 [PATCH 0/3] cfi: Use __builtin_function_start Sami Tolvanen
2022-04-01 20:19 ` [PATCH 1/3] kbuild: Change CFI_CLANG to depend on __builtin_function_start Sami Tolvanen
2022-04-02 13:31   ` Masahiro Yamada
2022-04-04 19:40     ` Sami Tolvanen
2022-04-04 22:52       ` Nathan Chancellor
2022-04-05  2:53         ` Kees Cook
2022-04-01 20:19 ` [PATCH 2/3] linux/compiler-clang.h: define function_nocfi Sami Tolvanen
2022-04-05 16:16   ` Mark Rutland
2022-04-01 20:19 ` Sami Tolvanen [this message]
2022-04-04  9:03   ` [PATCH 3/3] arm64: Drop the inline assembly implementation of function_nocfi Will Deacon
2022-04-05 16:23   ` Mark Rutland
2022-04-01 20:49 ` [PATCH 0/3] cfi: Use __builtin_function_start Nick Desaulniers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220401201916.1487500-4-samitolvanen@google.com \
    --to=samitolvanen@google.com \
    --cc=catalin.marinas@arm.com \
    --cc=keescook@chromium.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=mark.rutland@arm.com \
    --cc=masahiroy@kernel.org \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).