public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: H.J. Lu <hjl@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc] x86/cet: Check CPU_FEATURE_ACTIVE in permissive mode
Date: Tue, 19 Dec 2023 14:58:42 +0000 (GMT)	[thread overview]
Message-ID: <20231219145842.A3D323857348@sourceware.org> (raw)

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 ());

                 reply	other threads:[~2023-12-19 14:58 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231219145842.A3D323857348@sourceware.org \
    --to=hjl@sourceware.org \
    --cc=glibc-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).