mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-31 16:38:12 +00:00
314bcbf09f
Add some tests that verify that BTI functions correctly for static binaries built with and without BTI support, verifying that SIGILL is generated when expected and is not generated in other situations. Since BTI support is still being rolled out in distributions these tests are built entirely free standing, no libc support is used at all so none of the standard helper functions for kselftest can be used and we open code everything. This also means we aren't testing the kernel support for the dynamic linker, though the test program can be readily adapted for that once it becomes something that we can reliably build and run. These tests were originally written by Dave Martin, I've adapted them for kselftest, mainly around the build system and the output format. Signed-off-by: Mark Brown <broonie@kernel.org> Cc: Dave Martin <Dave.Martin@arm.com> Link: https://lore.kernel.org/r/20210309193731.57247-1-broonie@kernel.org Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
66 lines
1.6 KiB
Makefile
66 lines
1.6 KiB
Makefile
# SPDX-License-Identifier: GPL-2.0
|
|
|
|
# When ARCH not overridden for crosscompiling, lookup machine
|
|
ARCH ?= $(shell uname -m 2>/dev/null || echo not)
|
|
|
|
ifneq (,$(filter $(ARCH),aarch64 arm64))
|
|
ARM64_SUBTARGETS ?= tags signal pauth fp mte bti
|
|
else
|
|
ARM64_SUBTARGETS :=
|
|
endif
|
|
|
|
CFLAGS := -Wall -O2 -g
|
|
|
|
# A proper top_srcdir is needed by KSFT(lib.mk)
|
|
top_srcdir = $(realpath ../../../../)
|
|
|
|
# Additional include paths needed by kselftest.h and local headers
|
|
CFLAGS += -I$(top_srcdir)/tools/testing/selftests/
|
|
|
|
# Guessing where the Kernel headers could have been installed
|
|
# depending on ENV config
|
|
ifeq ($(KBUILD_OUTPUT),)
|
|
khdr_dir = $(top_srcdir)/usr/include
|
|
else
|
|
# the KSFT preferred location when KBUILD_OUTPUT is set
|
|
khdr_dir = $(KBUILD_OUTPUT)/kselftest/usr/include
|
|
endif
|
|
|
|
CFLAGS += -I$(khdr_dir)
|
|
|
|
export CFLAGS
|
|
export top_srcdir
|
|
|
|
all:
|
|
@for DIR in $(ARM64_SUBTARGETS); do \
|
|
BUILD_TARGET=$(OUTPUT)/$$DIR; \
|
|
mkdir -p $$BUILD_TARGET; \
|
|
make OUTPUT=$$BUILD_TARGET -C $$DIR $@; \
|
|
done
|
|
|
|
install: all
|
|
@for DIR in $(ARM64_SUBTARGETS); do \
|
|
BUILD_TARGET=$(OUTPUT)/$$DIR; \
|
|
make OUTPUT=$$BUILD_TARGET -C $$DIR $@; \
|
|
done
|
|
|
|
run_tests: all
|
|
@for DIR in $(ARM64_SUBTARGETS); do \
|
|
BUILD_TARGET=$(OUTPUT)/$$DIR; \
|
|
make OUTPUT=$$BUILD_TARGET -C $$DIR $@; \
|
|
done
|
|
|
|
# Avoid any output on non arm64 on emit_tests
|
|
emit_tests: all
|
|
@for DIR in $(ARM64_SUBTARGETS); do \
|
|
BUILD_TARGET=$(OUTPUT)/$$DIR; \
|
|
make OUTPUT=$$BUILD_TARGET -C $$DIR $@; \
|
|
done
|
|
|
|
clean:
|
|
@for DIR in $(ARM64_SUBTARGETS); do \
|
|
BUILD_TARGET=$(OUTPUT)/$$DIR; \
|
|
make OUTPUT=$$BUILD_TARGET -C $$DIR $@; \
|
|
done
|
|
|
|
.PHONY: all clean install run_tests emit_tests
|