From: Trevor Allison <tallison@redhat.com>
To: peterz@infradead.org, mingo@redhat.com, acme@kernel.org,
namhyung@kernel.org
Cc: mark.rutland@arm.com, alexander.shishkin@linux.intel.com,
jolsa@kernel.org, irogers@google.com, adrian.hunter@intel.com,
james.clark@linaro.org, tallison@redhat.com,
linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 3/3] perf x86: Add .note.gnu.property to assembly linked into perf
Date: Wed, 8 Jul 2026 00:56:06 -0400 [thread overview]
Message-ID: <20260708045606.43649-4-tallison@redhat.com> (raw)
In-Reply-To: <20260708045606.43649-1-tallison@redhat.com>
Assembly sources do not get .note.gnu.property from the compiler.
Add the section to the x86 files that are linked into perf, using the
same approach as the existing .note.GNU-stack notes.
Signed-off-by: Trevor Allison <tallison@redhat.com>
---
tools/perf/arch/x86/tests/regs_load.S | 24 ++++++++++++++++++++++++
tools/perf/bench/mem-memcpy-x86-64-asm.S | 24 ++++++++++++++++++++++++
tools/perf/bench/mem-memset-x86-64-asm.S | 24 ++++++++++++++++++++++++
3 files changed, 72 insertions(+)
diff --git a/tools/perf/arch/x86/tests/regs_load.S b/tools/perf/arch/x86/tests/regs_load.S
index 80f14f52e3f6..1947f95cceda 100644
--- a/tools/perf/arch/x86/tests/regs_load.S
+++ b/tools/perf/arch/x86/tests/regs_load.S
@@ -97,3 +97,27 @@ SYM_FUNC_END(perf_regs_load)
* the ELF stack should not be restricted at all and set it RWX.
*/
.section .note.GNU-stack,"",@progbits
+
+/*
+ * We need to provide .note.gnu.property section with IBT and SHSTK,
+ * saying that this object supports the same CET properties as C code
+ * built with -fcf-protection. Otherwise static linking drops CET from
+ * the final perf binary when other objects are CET-enabled.
+ */
+ .pushsection .note.gnu.property, "a"
+ .p2align 3
+ .long 1f - 0f
+ .long 4f - 1f
+ .long 5
+0:
+ .asciz "GNU"
+1:
+ .p2align 3
+ .long 0xc0000002
+ .long 3f - 2f
+2:
+ .long 3
+3:
+ .p2align 3
+4:
+ .popsection
diff --git a/tools/perf/bench/mem-memcpy-x86-64-asm.S b/tools/perf/bench/mem-memcpy-x86-64-asm.S
index 1b9fef7efcdc..e7b84aa43ab4 100644
--- a/tools/perf/bench/mem-memcpy-x86-64-asm.S
+++ b/tools/perf/bench/mem-memcpy-x86-64-asm.S
@@ -18,3 +18,27 @@
* the ELF stack should not be restricted at all and set it RWX.
*/
.section .note.GNU-stack,"",@progbits
+
+/*
+ * We need to provide .note.gnu.property section with IBT and SHSTK,
+ * saying that this object supports the same CET properties as C code
+ * built with -fcf-protection. Otherwise static linking drops CET from
+ * the final perf binary when other objects are CET-enabled.
+ */
+ .pushsection .note.gnu.property, "a"
+ .p2align 3
+ .long 1f - 0f
+ .long 4f - 1f
+ .long 5
+0:
+ .asciz "GNU"
+1:
+ .p2align 3
+ .long 0xc0000002
+ .long 3f - 2f
+2:
+ .long 3
+3:
+ .p2align 3
+4:
+ .popsection
diff --git a/tools/perf/bench/mem-memset-x86-64-asm.S b/tools/perf/bench/mem-memset-x86-64-asm.S
index abd26c95f1aa..f8002da91c3c 100644
--- a/tools/perf/bench/mem-memset-x86-64-asm.S
+++ b/tools/perf/bench/mem-memset-x86-64-asm.S
@@ -13,3 +13,27 @@
* the ELF stack should not be restricted at all and set it RWX.
*/
.section .note.GNU-stack,"",@progbits
+
+/*
+ * We need to provide .note.gnu.property section with IBT and SHSTK,
+ * saying that this object supports the same CET properties as C code
+ * built with -fcf-protection. Otherwise static linking drops CET from
+ * the final perf binary when other objects are CET-enabled.
+ */
+ .pushsection .note.gnu.property, "a"
+ .p2align 3
+ .long 1f - 0f
+ .long 4f - 1f
+ .long 5
+0:
+ .asciz "GNU"
+1:
+ .p2align 3
+ .long 0xc0000002
+ .long 3f - 2f
+2:
+ .long 3
+3:
+ .p2align 3
+4:
+ .popsection
--
2.50.1 (Apple Git-155)
next prev parent reply other threads:[~2026-07-08 4:57 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-08 4:56 [PATCH 0/3] perf: Fix missing CET property notes on x86 with -fcf-protection Trevor Allison
2026-07-08 4:56 ` [PATCH 1/3] perf build: Preserve EXTRA_CFLAGS when building in-tree libbpf Trevor Allison
2026-07-08 4:56 ` [PATCH 2/3] perf build: Apply EXTRA_CXXFLAGS to C++ builds Trevor Allison
2026-07-08 5:03 ` sashiko-bot
2026-07-08 4:56 ` Trevor Allison [this message]
2026-07-08 5:08 ` [PATCH 3/3] perf x86: Add .note.gnu.property to assembly linked into perf sashiko-bot
2026-07-13 20:33 ` Namhyung Kim
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=20260708045606.43649-4-tallison@redhat.com \
--to=tallison@redhat.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=irogers@google.com \
--cc=james.clark@linaro.org \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.