kselftest: arm64: Add BTI tests
authorMark Brown <broonie@kernel.org>
Tue, 9 Mar 2021 19:37:31 +0000 (19:37 +0000)
committerCatalin Marinas <catalin.marinas@arm.com>
Wed, 24 Mar 2021 15:43:20 +0000 (15:43 +0000)
commit314bcbf09f147cfb069bc22207215b6b0b7da510
tree2f40e8b4b1e21e84c693821a1786399be5a93936
parent75347add03e0fa60ecf2f79e41ec2152b8504593
kselftest: arm64: Add BTI tests

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>
16 files changed:
tools/testing/selftests/arm64/Makefile
tools/testing/selftests/arm64/bti/.gitignore [new file with mode: 0644]
tools/testing/selftests/arm64/bti/Makefile [new file with mode: 0644]
tools/testing/selftests/arm64/bti/assembler.h [new file with mode: 0644]
tools/testing/selftests/arm64/bti/btitest.h [new file with mode: 0644]
tools/testing/selftests/arm64/bti/compiler.h [new file with mode: 0644]
tools/testing/selftests/arm64/bti/gen/.gitignore [new file with mode: 0644]
tools/testing/selftests/arm64/bti/signal.c [new file with mode: 0644]
tools/testing/selftests/arm64/bti/signal.h [new file with mode: 0644]
tools/testing/selftests/arm64/bti/start.S [new file with mode: 0644]
tools/testing/selftests/arm64/bti/syscall.S [new file with mode: 0644]
tools/testing/selftests/arm64/bti/system.c [new file with mode: 0644]
tools/testing/selftests/arm64/bti/system.h [new file with mode: 0644]
tools/testing/selftests/arm64/bti/test.c [new file with mode: 0644]
tools/testing/selftests/arm64/bti/teststubs.S [new file with mode: 0644]
tools/testing/selftests/arm64/bti/trampoline.S [new file with mode: 0644]