mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2025-01-09 23:34:42 +08:00
e74e1d5572
PAuth signs and verifies return addresses on the stack. It does so by inserting a Pointer Authentication code (PAC) into some of the unused top bits of an address. This is achieved by adding paciasp/autiasp instructions at the beginning and end of a function. This feature is partially backwards compatible with earlier versions of the ARM architecture. To coerce the compiler into emitting fully backwards compatible code the main file is compiled to target an earlier ARM version. This allows the tests to check for the feature and print meaningful error messages instead of crashing. Add a test to verify that corrupting the return address results in a SIGSEGV on return. Signed-off-by: Boyan Karatotev <boyan.karatotev@arm.com> Reviewed-by: Vincenzo Frascino <Vincenzo.Frascino@arm.com> Reviewed-by: Amit Daniel Kachhap <amit.kachhap@arm.com> Acked-by: Shuah Khan <skhan@linuxfoundation.org> Cc: Shuah Khan <shuah@kernel.org> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Will Deacon <will@kernel.org> Link: https://lore.kernel.org/r/20200918104715.182310-2-boian4o1@gmail.com Signed-off-by: Will Deacon <will@kernel.org>
67 lines
1.6 KiB
Makefile
67 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
|
|
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
|