Patch "kselftest/arm64: bti: force static linking" has been added to the 5.15-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    kselftest/arm64: bti: force static linking

to the 5.15-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     kselftest-arm64-bti-force-static-linking.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 029bfe42782fe361c14299a40a53eb00f6bd4469
Author: Andre Przywara <andre.przywara@xxxxxxx>
Date:   Wed May 11 18:21:29 2022 +0100

    kselftest/arm64: bti: force static linking
    
    [ Upstream commit d7a49291d786b4400996afe3afcc3ef5eeb6f0ef ]
    
    The "bti" selftests are built with -nostdlib, which apparently
    automatically creates a statically linked binary, which is what we want
    and need for BTI (to avoid interactions with the dynamic linker).
    
    However this is not true when building a PIE binary, which some
    toolchains (Ubuntu) configure as the default.
    When compiling btitest with such a toolchain, it will create a
    dynamically linked binary, which will probably fail some tests, as the
    dynamic linker might not support BTI:
    ===================
    TAP version 13
    1..18
    not ok 1 nohint_func/call_using_br_x0
    not ok 2 nohint_func/call_using_br_x16
    not ok 3 nohint_func/call_using_blr
    ....
    ===================
    
    To make sure we create static binaries, add an explicit -static on the
    linker command line. This forces static linking even if the toolchain
    defaults to PIE builds, and fixes btitest runs on BTI enabled machines.
    
    Signed-off-by: Andre Przywara <andre.przywara@xxxxxxx>
    Reviewed-by: Mark Brown <broonie@xxxxxxxxxx>
    Fixes: 314bcbf09f14 ("kselftest: arm64: Add BTI tests")
    Link: https://lore.kernel.org/r/20220511172129.2078337-1-andre.przywara@xxxxxxx
    Signed-off-by: Catalin Marinas <catalin.marinas@xxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/tools/testing/selftests/arm64/bti/Makefile b/tools/testing/selftests/arm64/bti/Makefile
index 73e013c082a6..dafa1c2aa5c4 100644
--- a/tools/testing/selftests/arm64/bti/Makefile
+++ b/tools/testing/selftests/arm64/bti/Makefile
@@ -39,7 +39,7 @@ BTI_OBJS =                                      \
 	teststubs-bti.o                         \
 	trampoline-bti.o
 gen/btitest: $(BTI_OBJS)
-	$(CC) $(CFLAGS_BTI) $(CFLAGS_COMMON) -nostdlib -o $@ $^
+	$(CC) $(CFLAGS_BTI) $(CFLAGS_COMMON) -nostdlib -static -o $@ $^
 
 NOBTI_OBJS =                                    \
 	test-nobti.o                         \
@@ -50,7 +50,7 @@ NOBTI_OBJS =                                    \
 	teststubs-nobti.o                       \
 	trampoline-nobti.o
 gen/nobtitest: $(NOBTI_OBJS)
-	$(CC) $(CFLAGS_BTI) $(CFLAGS_COMMON) -nostdlib -o $@ $^
+	$(CC) $(CFLAGS_BTI) $(CFLAGS_COMMON) -nostdlib -static -o $@ $^
 
 # Including KSFT lib.mk here will also mangle the TEST_GEN_PROGS list
 # to account for any OUTPUT target-dirs optionally provided by



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux