forked from rpms/glibc
144f612406
Downstream only and disabled by default.
50 lines
1.6 KiB
Diff
50 lines
1.6 KiB
Diff
From 8230fefd2495d1fb7fa72c680dc10ae4d10fde61 Mon Sep 17 00:00:00 2001
|
|
From: "H.J. Lu" <hjl.tools@gmail.com>
|
|
Date: Tue, 28 Mar 2023 13:52:36 -0700
|
|
Subject: [PATCH v2 08/15] x86/cet: Check CPU_FEATURE_ACTIVE in permissive mode
|
|
|
|
Verify that CPU_FEATURE_ACTIVE works properly in permissive mode.
|
|
---
|
|
sysdeps/x86/Makefile | 1 +
|
|
sysdeps/x86/tst-cet-legacy-4.c | 5 +++++
|
|
2 files changed, 6 insertions(+)
|
|
|
|
diff --git a/sysdeps/x86/Makefile b/sysdeps/x86/Makefile
|
|
index b8b98177e0..6ceefe16c7 100644
|
|
--- a/sysdeps/x86/Makefile
|
|
+++ b/sysdeps/x86/Makefile
|
|
@@ -174,6 +174,7 @@ CFLAGS-tst-cet-legacy-mod-1.c += -fcf-protection=none
|
|
CFLAGS-tst-cet-legacy-mod-2.c += -fcf-protection=none
|
|
CFLAGS-tst-cet-legacy-3.c += -fcf-protection=none
|
|
CFLAGS-tst-cet-legacy-4.c += -fcf-protection=branch
|
|
+CPPFLAGS-tst-cet-legacy-4a.c += -DCET_IS_PERMISSIVE=1
|
|
CFLAGS-tst-cet-legacy-4a.c += -fcf-protection
|
|
CFLAGS-tst-cet-legacy-4b.c += -fcf-protection
|
|
CFLAGS-tst-cet-legacy-mod-4.c += -fcf-protection=none
|
|
diff --git a/sysdeps/x86/tst-cet-legacy-4.c b/sysdeps/x86/tst-cet-legacy-4.c
|
|
index d75fb0e61c..c098120253 100644
|
|
--- a/sysdeps/x86/tst-cet-legacy-4.c
|
|
+++ b/sysdeps/x86/tst-cet-legacy-4.c
|
|
@@ -21,6 +21,7 @@
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
+#include <sys/platform/x86.h>
|
|
|
|
#include <support/check.h>
|
|
|
|
@@ -40,6 +41,10 @@ do_test (void)
|
|
return 0;
|
|
}
|
|
|
|
+#ifdef CET_IS_PERMISSIVE
|
|
+ TEST_VERIFY (!CPU_FEATURE_ACTIVE (IBT) && !CPU_FEATURE_ACTIVE (SHSTK));
|
|
+#endif
|
|
+
|
|
fp = dlsym (h, "test");
|
|
if (fp == NULL)
|
|
FAIL_EXIT1 ("cannot get symbol 'test': %s\n", dlerror ());
|
|
--
|
|
2.40.1
|
|
|