From: Seke Kazuru <kazuruuni@gmail.com>
To: joe.lawrence@redhat.com
Cc: live-patching@vger.kernel.org, jpoimboe@kernel.org,
mbenes@suse.cz, pmladek@suse.com, song@kernel.org,
peterz@infradead.org, linux-kernel@vger.kernel.org
Subject: [PATCH] objtool/klp: Build x86 test fixtures with -fcf-protection=none
Date: Tue, 1 Dec 2026 17:17:38 +0200 [thread overview]
Message-ID: <20261201151738.1776-1-kazuruuni@gmail.com> (raw)
x86 kernels always choose -fcf-protection themselves: =branch with
CONFIG_X86_KERNEL_IBT, =none without (arch/x86/Makefile). The test
fixtures pass neither, so they get the compiler's default, and Ubuntu's
gcc defaults to =full. That puts an ENDBR at the start of a global
function but not of a static one, so a patch which only changes a
function's linkage changes its code.
test-local-to-global-flip makes exactly that change and fails with
Ubuntu's gcc 11 to 14: flipped_up gains an ENDBR, klp diff rightly
reports it as changed and clones it, and the test, which expects it to
be correlated, fails.
Build the fixtures for the kernel without IBT, as the kernel would. A
test about IBT can still override it.
Verified with Ubuntu gcc 11, 13 and 14, Debian gcc 16 and Clang 18 and
23: test-local-to-global-flip fails on the three Ubuntu compilers before
this change and passes after it, and no other test changes on any of
the six.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Seke Kazuru <kazuruuni@gmail.com>
---
tools/objtool/tests/lib.sh | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/tools/objtool/tests/lib.sh b/tools/objtool/tests/lib.sh
index 4da168d0dd..41048960f8 100644
--- a/tools/objtool/tests/lib.sh
+++ b/tools/objtool/tests/lib.sh
@@ -153,6 +153,15 @@ EOF
FIXTURE_CFLAGS="-O2 -ffunction-sections -fdata-sections -fno-common \
-fno-asynchronous-unwind-tables"
+# x86 kernels always choose -fcf-protection themselves (arch/x86/Makefile):
+# =branch with CONFIG_X86_KERNEL_IBT, =none without. A compiler's default never
+# reaches kernel code, and some distributions' gcc defaults to =full, which puts
+# an ENDBR at the start of a global function but not of a static one -- so a
+# patch which only changes a function's linkage would change its code. Stand
+# in for the kernel without IBT; a test about IBT overrides it.
+[ "$KLP_TEST_ARCH" != x86 ] ||
+ FIXTURE_CFLAGS="$FIXTURE_CFLAGS -fcf-protection=none"
+
test_name="$(basename "$0" .sh)"
workdir=
--
2.43.0
reply other threads:[~2026-12-01 15:17 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261201151738.1776-1-kazuruuni@gmail.com \
--to=kazuruuni@gmail.com \
--cc=joe.lawrence@redhat.com \
--cc=jpoimboe@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=live-patching@vger.kernel.org \
--cc=mbenes@suse.cz \
--cc=peterz@infradead.org \
--cc=pmladek@suse.com \
--cc=song@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