lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 30 Sep 2021 11:05:19 -0700
From:   Sami Tolvanen <>
Cc:     Kees Cook <>,
        Josh Poimboeuf <>,
        Peter Zijlstra <>,
        Nathan Chancellor <>,
        Nick Desaulniers <>,
        Sedat Dilek <>,,,, Sami Tolvanen <>
Subject: [PATCH v4 03/15] linkage: Add DECLARE_ASM_FUNC_SYMBOL

The kernel has several assembly functions, which are not directly
callable from C but need to be referred to from C code. This change adds
the DECLARE_ASM_FUNC_SYMBOL macro, which allows us to declare these
symbols using an opaque type, which makes misuse harder, and avoids the
need to annotate references to the functions for Clang's Control-Flow
Integrity (CFI).

Suggested-by: Andy Lutomirski <>
Signed-off-by: Sami Tolvanen <>
 include/linux/linkage.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/include/linux/linkage.h b/include/linux/linkage.h
index dbf8506decca..f1eac26b2dd6 100644
--- a/include/linux/linkage.h
+++ b/include/linux/linkage.h
@@ -48,6 +48,19 @@
 #define __PAGE_ALIGNED_DATA	.section ".data..page_aligned", "aw"
 #define __PAGE_ALIGNED_BSS	.section ".bss..page_aligned", "aw"
+ * Declares a function not callable from C using an opaque type. Defined as
+ * an array to allow the address of the symbol to be taken without '&'.
+ */
+	extern const u8 sym[]
+#ifndef __ASSEMBLY__
+typedef const u8 *asm_func_ptr;
  * This is used by architectures to keep arguments on the stack
  * untouched by the compiler by keeping them live until the end.

Powered by blists - more mailing lists