This test is specific to MTE and verifies that the GCR_EL1 register is context switched correctly. It spawns 1024 processes and each process spawns 5 threads. Each thread writes a random setting of GCR_EL1 through the prctl() system call and reads it back verifying that it is the same. If the values are not the same it reports a failure. Note: The test has been extended to verify that even SYNC and ASYNC mode setting is preserved correctly over context switching. Link: https://lkml.kernel.org/r/b51a165426e906e7ec8a68d806ef3f8cd92581a6.1606161801.git.andreyknvl@google.com Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com> Signed-off-by: Andrey Konovalov <andreyknvl@google.com> Acked-by: Catalin Marinas <catalin.marinas@arm.com> Tested-by: Vincenzo Frascino <vincenzo.frascino@arm.com> Cc: Alexander Potapenko <glider@google.com> Cc: Andrey Ryabinin <aryabinin@virtuozzo.com> Cc: Branislav Rankov <Branislav.Rankov@arm.com> Cc: Dmitry Vyukov <dvyukov@google.com> Cc: Evgenii Stepanov <eugenis@google.com> Cc: Kevin Brodsky <kevin.brodsky@arm.com> Cc: Marco Elver <elver@google.com> Cc: Vasily Gorbik <gor@linux.ibm.com> Cc: Will Deacon <will.deacon@arm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
30 lines
793 B
Makefile
30 lines
793 B
Makefile
# SPDX-License-Identifier: GPL-2.0
|
|
# Copyright (C) 2020 ARM Limited
|
|
|
|
CFLAGS += -std=gnu99 -I. -lpthread
|
|
SRCS := $(filter-out mte_common_util.c,$(wildcard *.c))
|
|
PROGS := $(patsubst %.c,%,$(SRCS))
|
|
|
|
#Add mte compiler option
|
|
ifneq ($(shell $(CC) --version 2>&1 | head -n 1 | grep gcc),)
|
|
CFLAGS += -march=armv8.5-a+memtag
|
|
endif
|
|
|
|
#check if the compiler works well
|
|
mte_cc_support := $(shell if ($(CC) $(CFLAGS) -E -x c /dev/null -o /dev/null 2>&1) then echo "1"; fi)
|
|
|
|
ifeq ($(mte_cc_support),1)
|
|
# Generated binaries to be installed by top KSFT script
|
|
TEST_GEN_PROGS := $(PROGS)
|
|
|
|
# Get Kernel headers installed and use them.
|
|
KSFT_KHDR_INSTALL := 1
|
|
endif
|
|
|
|
# Include KSFT lib.mk.
|
|
include ../../lib.mk
|
|
|
|
ifeq ($(mte_cc_support),1)
|
|
$(TEST_GEN_PROGS): mte_common_util.c mte_common_util.h mte_helper.S
|
|
endif
|