[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 5/6] check-block: enable iotests with cfi-icall
From: |
Daniele Buono |
Subject: |
[PATCH v2 5/6] check-block: enable iotests with cfi-icall |
Date: |
Fri, 23 Oct 2020 16:06:43 -0400 |
cfi-icall is a form of Control-Flow Integrity for indirect function
calls implemented by llvm. It is enabled with a -fsanitize flag.
iotests are currently disabled when -fsanitize options is used, with the
exception of SafeStack.
This patch implements a generic filtering mechanism to allow iotests
with a set of known-to-be-safe -fsanitize option. Then marks SafeStack
and the new options used for cfi-icall safe for iotests
Signed-off-by: Daniele Buono <dbuono@linux.vnet.ibm.com>
---
tests/check-block.sh | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/tests/check-block.sh b/tests/check-block.sh
index f6b1bda7b9..fb4c1baae9 100755
--- a/tests/check-block.sh
+++ b/tests/check-block.sh
@@ -21,14 +21,18 @@ if grep -q "CONFIG_GPROF=y" config-host.mak 2>/dev/null ;
then
exit 0
fi
-# Disable tests with any sanitizer except for SafeStack
-CFLAGS=$( grep "CFLAGS.*-fsanitize" config-host.mak 2>/dev/null )
-SANITIZE_FLAGS=""
-#Remove all occurrencies of -fsanitize=safe-stack
-for i in ${CFLAGS}; do
- if [ "${i}" != "-fsanitize=safe-stack" ]; then
- SANITIZE_FLAGS="${SANITIZE_FLAGS} ${i}"
+# Disable tests with any sanitizer except for specific ones
+SANITIZE_FLAGS=$( grep "CFLAGS.*-fsanitize" config-host.mak 2>/dev/null )
+ALLOWED_SANITIZE_FLAGS="safe-stack cfi-icall"
+#Remove all occurrencies of allowed Sanitize flags
+for j in ${ALLOWED_SANITIZE_FLAGS}; do
+ TMP_FLAGS=${SANITIZE_FLAGS}
+ SANITIZE_FLAGS=""
+ for i in ${TMP_FLAGS}; do
+ if ! echo ${i} | grep -q "${j}" 2>/dev/null; then
+ SANITIZE_FLAGS="${SANITIZE_FLAGS} ${i}"
fi
+ done
done
if echo ${SANITIZE_FLAGS} | grep -q "\-fsanitize" 2>/dev/null; then
# Have a sanitize flag that is not allowed, stop
--
2.17.1
- Re: [PATCH v2 2/6] configure: avoid new clang 11+ warnings, (continued)
[PATCH v2 3/6] configure: add option to enable LTO, Daniele Buono, 2020/10/23
[PATCH v2 4/6] cfi: Initial support for cfi-icall in QEMU, Daniele Buono, 2020/10/23
[PATCH v2 5/6] check-block: enable iotests with cfi-icall,
Daniele Buono <=
[PATCH v2 6/6] configure: add support for Control-Flow Integrity, Daniele Buono, 2020/10/23
Re: [PATCH v2 0/6] Add support for Control-Flow Integrity, Eric Blake, 2020/10/23