From: Namhyung Kim <namhyung@kernel.org>
To: Arnaldo Carvalho de Melo <acme@kernel.org>,
Ian Rogers <irogers@google.com>,
Kan Liang <kan.liang@linux.intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>,
Adrian Hunter <adrian.hunter@intel.com>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
linux-perf-users@vger.kernel.org, x86@kernel.org
Subject: [PATCH 10/10] tools headers: Update the arch/x86/lib/memset_64.S copy with the kernel sources
Date: Wed, 9 Apr 2025 17:11:25 -0700 [thread overview]
Message-ID: <20250410001125.391820-11-namhyung@kernel.org> (raw)
In-Reply-To: <20250410001125.391820-1-namhyung@kernel.org>
To pick up the changes in:
2981557cb0408e14 x86,kcfi: Fix EXPORT_SYMBOL vs kCFI
That required adding a copy of include/linux/cfi_types.h and its checking
in tools/perf/check-headers.h.
Addressing this perf tools build warning:
Warning: Kernel ABI header differences:
diff -u tools/arch/x86/lib/memset_64.S arch/x86/lib/memset_64.S
Please see tools/include/uapi/README for further details.
Cc: x86@kernel.org
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/arch/x86/lib/memset_64.S | 3 ++-
tools/include/linux/cfi_types.h | 45 +++++++++++++++++++++++++++++++++
| 1 +
3 files changed, 48 insertions(+), 1 deletion(-)
create mode 100644 tools/include/linux/cfi_types.h
diff --git a/tools/arch/x86/lib/memset_64.S b/tools/arch/x86/lib/memset_64.S
index 0199d56cb479d88c..d66b710d628f8865 100644
--- a/tools/arch/x86/lib/memset_64.S
+++ b/tools/arch/x86/lib/memset_64.S
@@ -3,6 +3,7 @@
#include <linux/export.h>
#include <linux/linkage.h>
+#include <linux/cfi_types.h>
#include <asm/cpufeatures.h>
#include <asm/alternative.h>
@@ -28,7 +29,7 @@
* only for the return value that is the same as the source input,
* which the compiler could/should do much better anyway.
*/
-SYM_FUNC_START(__memset)
+SYM_TYPED_FUNC_START(__memset)
ALTERNATIVE "jmp memset_orig", "", X86_FEATURE_FSRS
movq %rdi,%r9
diff --git a/tools/include/linux/cfi_types.h b/tools/include/linux/cfi_types.h
new file mode 100644
index 0000000000000000..6b87136757655c05
--- /dev/null
+++ b/tools/include/linux/cfi_types.h
@@ -0,0 +1,45 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Clang Control Flow Integrity (CFI) type definitions.
+ */
+#ifndef _LINUX_CFI_TYPES_H
+#define _LINUX_CFI_TYPES_H
+
+#ifdef __ASSEMBLY__
+#include <linux/linkage.h>
+
+#ifdef CONFIG_CFI_CLANG
+/*
+ * Use the __kcfi_typeid_<function> type identifier symbol to
+ * annotate indirectly called assembly functions. The compiler emits
+ * these symbols for all address-taken function declarations in C
+ * code.
+ */
+#ifndef __CFI_TYPE
+#define __CFI_TYPE(name) \
+ .4byte __kcfi_typeid_##name
+#endif
+
+#define SYM_TYPED_ENTRY(name, linkage, align...) \
+ linkage(name) ASM_NL \
+ align ASM_NL \
+ __CFI_TYPE(name) ASM_NL \
+ name:
+
+#define SYM_TYPED_START(name, linkage, align...) \
+ SYM_TYPED_ENTRY(name, linkage, align)
+
+#else /* CONFIG_CFI_CLANG */
+
+#define SYM_TYPED_START(name, linkage, align...) \
+ SYM_START(name, linkage, align)
+
+#endif /* CONFIG_CFI_CLANG */
+
+#ifndef SYM_TYPED_FUNC_START
+#define SYM_TYPED_FUNC_START(name) \
+ SYM_TYPED_START(name, SYM_L_GLOBAL, SYM_A_ALIGN)
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* _LINUX_CFI_TYPES_H */
--git a/tools/perf/check-headers.sh b/tools/perf/check-headers.sh
index a4499e5a6f9cb00c..857f6646cc23e949 100755
--- a/tools/perf/check-headers.sh
+++ b/tools/perf/check-headers.sh
@@ -20,6 +20,7 @@ FILES=(
"include/uapi/linux/stat.h"
"include/linux/bits.h"
"include/vdso/bits.h"
+ "include/linux/cfi_types.h"
"include/linux/const.h"
"include/vdso/const.h"
"include/vdso/unaligned.h"
--
2.49.0.504.g3bcea36a83-goog
next prev parent reply other threads:[~2025-04-10 0:11 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-10 0:11 [PATCHSET 00/10] tools headers: Sync header files with the kernel Namhyung Kim
2025-04-10 0:11 ` [PATCH 01/10] tools headers: Update the KVM headers with the kernel sources Namhyung Kim
2025-04-10 0:11 ` [PATCH 02/10] tools headers: Update the socket " Namhyung Kim
2025-04-10 0:11 ` [PATCH 03/10] tools headers: Update the uapi/linux/perf_event.h copy " Namhyung Kim
2025-04-10 0:11 ` [PATCH 04/10] tools headers: Update the VFS headers " Namhyung Kim
2025-04-10 0:11 ` [PATCH 05/10] tools headers: Update the syscall table " Namhyung Kim
2025-04-14 16:28 ` James Clark
2025-04-16 13:26 ` James Clark
2025-04-23 9:24 ` Jon Hunter
2025-04-23 14:57 ` James Clark
2025-04-24 7:33 ` Jon Hunter
2025-04-10 0:11 ` [PATCH 06/10] tools headers: Update the uapi/linux/prctl.h copy " Namhyung Kim
2025-04-10 0:11 ` [PATCH 07/10] tools headers: Update the uapi/asm-generic/mman-common.h " Namhyung Kim
2025-04-10 0:11 ` [PATCH 08/10] tools headers: Update the linux/unaligned.h " Namhyung Kim
2025-04-10 0:11 ` [PATCH 09/10] tools headers: Update the x86 headers " Namhyung Kim
2025-04-10 0:11 ` Namhyung Kim [this message]
2025-04-10 6:02 ` [PATCHSET 00/10] tools headers: Sync header files with the kernel Ingo Molnar
2025-04-10 11:31 ` Venkat
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=20250410001125.391820-11-namhyung@kernel.org \
--to=namhyung@kernel.org \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=kan.liang@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=x86@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