public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc] x86/cet: Check CPU_FEATURE_ACTIVE in permissive mode
@ 2023-12-19 14:58 H.J. Lu
  0 siblings, 0 replies; only message in thread
From: H.J. Lu @ 2023-12-19 14:58 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=4d8a01d2b0963f7c7714ff53c313430599f0722f

commit 4d8a01d2b0963f7c7714ff53c313430599f0722f
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue Mar 28 13:52:36 2023 -0700

    x86/cet: Check CPU_FEATURE_ACTIVE in permissive mode
    
    Verify that CPU_FEATURE_ACTIVE works properly in permissive mode.

Diff:
---
 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 1bf6ff9e11..6911a07a87 100644
--- a/sysdeps/x86/Makefile
+++ b/sysdeps/x86/Makefile
@@ -219,6 +219,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 ());

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-12-19 14:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-19 14:58 [glibc] x86/cet: Check CPU_FEATURE_ACTIVE in permissive mode H.J. Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).