diff mbox series

[05/17] x86/cet: Check CPU_FEATURE_ACTIVE when CET is disabled

Message ID 20231206172010.1023415-6-hjl.tools@gmail.com
State New
Headers show
Series x86/cet: Update CET kernel interface | expand

Commit Message

H.J. Lu Dec. 6, 2023, 5:19 p.m. UTC
Verify that CPU_FEATURE_ACTIVE (SHSTK) works properly when CET is
disabled.
---
 sysdeps/x86/Makefile                    | 8 ++++++--
 sysdeps/x86/tst-cet-legacy-10a-static.c | 2 ++
 sysdeps/x86/tst-cet-legacy-10a.c        | 2 ++
 3 files changed, 10 insertions(+), 2 deletions(-)
 create mode 100644 sysdeps/x86/tst-cet-legacy-10a-static.c
 create mode 100644 sysdeps/x86/tst-cet-legacy-10a.c

Comments

Noah Goldstein Dec. 6, 2023, 11:53 p.m. UTC | #1
On Wed, Dec 6, 2023 at 11:20 AM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> Verify that CPU_FEATURE_ACTIVE (SHSTK) works properly when CET is
> disabled.
> ---
>  sysdeps/x86/Makefile                    | 8 ++++++--
>  sysdeps/x86/tst-cet-legacy-10a-static.c | 2 ++
>  sysdeps/x86/tst-cet-legacy-10a.c        | 2 ++
>  3 files changed, 10 insertions(+), 2 deletions(-)
>  create mode 100644 sysdeps/x86/tst-cet-legacy-10a-static.c
>  create mode 100644 sysdeps/x86/tst-cet-legacy-10a.c
>
> diff --git a/sysdeps/x86/Makefile b/sysdeps/x86/Makefile
> index dea14e343c..580c3ecdc5 100644
> --- a/sysdeps/x86/Makefile
> +++ b/sysdeps/x86/Makefile
> @@ -126,8 +126,10 @@ tests += tst-cet-legacy-1 tst-cet-legacy-1a tst-cet-legacy-2 \
>          tst-cet-legacy-2a tst-cet-legacy-3 tst-cet-legacy-4 \
>          tst-cet-legacy-5a tst-cet-legacy-6a tst-cet-legacy-7 \
>          tst-cet-legacy-8 tst-cet-legacy-9 tst-cet-legacy-9-static \
> -        tst-cet-legacy-10 tst-cet-legacy-10-static
> -tests-static += tst-cet-legacy-9-static tst-cet-legacy-10-static
> +        tst-cet-legacy-10 tst-cet-legacy-10-static \
> +        tst-cet-legacy-10a tst-cet-legacy-10a-static
> +tests-static += tst-cet-legacy-9-static tst-cet-legacy-10-static \
> +               tst-cet-legacy-10a-static
>  tst-cet-legacy-1a-ARGS = -- $(host-test-program-cmd)
>
maybe pre commit splitting to target per line.
>  tests += \
> @@ -182,6 +184,8 @@ CFLAGS-tst-cet-legacy-mod-6c.c += -fcf-protection
>  CFLAGS-tst-cet-legacy-7.c += -fcf-protection=none
>  CFLAGS-tst-cet-legacy-10.c += -mshstk
>  CFLAGS-tst-cet-legacy-10-static.c += -mshstk
> +CFLAGS-tst-cet-legacy-10a.c += -fcf-protection=none
> +CFLAGS-tst-cet-legacy-10a-static.c += -fcf-protection=none
>
>  CFLAGS-tst-shstk-legacy-1a.c += -fcf-protection=none
>  CFLAGS-tst-shstk-legacy-1a-static.c += -fcf-protection=none
> diff --git a/sysdeps/x86/tst-cet-legacy-10a-static.c b/sysdeps/x86/tst-cet-legacy-10a-static.c
> new file mode 100644
> index 0000000000..05073a5d1e
> --- /dev/null
> +++ b/sysdeps/x86/tst-cet-legacy-10a-static.c
> @@ -0,0 +1,2 @@
> +#pragma GCC target ("shstk")
> +#include "tst-cet-legacy-10.c"
> diff --git a/sysdeps/x86/tst-cet-legacy-10a.c b/sysdeps/x86/tst-cet-legacy-10a.c
> new file mode 100644
> index 0000000000..05073a5d1e
> --- /dev/null
> +++ b/sysdeps/x86/tst-cet-legacy-10a.c
> @@ -0,0 +1,2 @@
> +#pragma GCC target ("shstk")
> +#include "tst-cet-legacy-10.c"
> --
> 2.43.0
>
H.J. Lu Dec. 7, 2023, 9:07 p.m. UTC | #2
On Wed, Dec 6, 2023 at 3:53 PM Noah Goldstein <goldstein.w.n@gmail.com> wrote:
>
> On Wed, Dec 6, 2023 at 11:20 AM H.J. Lu <hjl.tools@gmail.com> wrote:
> >
> > Verify that CPU_FEATURE_ACTIVE (SHSTK) works properly when CET is
> > disabled.
> > ---
> >  sysdeps/x86/Makefile                    | 8 ++++++--
> >  sysdeps/x86/tst-cet-legacy-10a-static.c | 2 ++
> >  sysdeps/x86/tst-cet-legacy-10a.c        | 2 ++
> >  3 files changed, 10 insertions(+), 2 deletions(-)
> >  create mode 100644 sysdeps/x86/tst-cet-legacy-10a-static.c
> >  create mode 100644 sysdeps/x86/tst-cet-legacy-10a.c
> >
> > diff --git a/sysdeps/x86/Makefile b/sysdeps/x86/Makefile
> > index dea14e343c..580c3ecdc5 100644
> > --- a/sysdeps/x86/Makefile
> > +++ b/sysdeps/x86/Makefile
> > @@ -126,8 +126,10 @@ tests += tst-cet-legacy-1 tst-cet-legacy-1a tst-cet-legacy-2 \
> >          tst-cet-legacy-2a tst-cet-legacy-3 tst-cet-legacy-4 \
> >          tst-cet-legacy-5a tst-cet-legacy-6a tst-cet-legacy-7 \
> >          tst-cet-legacy-8 tst-cet-legacy-9 tst-cet-legacy-9-static \
> > -        tst-cet-legacy-10 tst-cet-legacy-10-static
> > -tests-static += tst-cet-legacy-9-static tst-cet-legacy-10-static
> > +        tst-cet-legacy-10 tst-cet-legacy-10-static \
> > +        tst-cet-legacy-10a tst-cet-legacy-10a-static
> > +tests-static += tst-cet-legacy-9-static tst-cet-legacy-10-static \
> > +               tst-cet-legacy-10a-static
> >  tst-cet-legacy-1a-ARGS = -- $(host-test-program-cmd)
> >
> maybe pre commit splitting to target per line.

I sent out a separate patch against the master branch to put each test
on a separate line.

Thanks.

> >  tests += \
> > @@ -182,6 +184,8 @@ CFLAGS-tst-cet-legacy-mod-6c.c += -fcf-protection
> >  CFLAGS-tst-cet-legacy-7.c += -fcf-protection=none
> >  CFLAGS-tst-cet-legacy-10.c += -mshstk
> >  CFLAGS-tst-cet-legacy-10-static.c += -mshstk
> > +CFLAGS-tst-cet-legacy-10a.c += -fcf-protection=none
> > +CFLAGS-tst-cet-legacy-10a-static.c += -fcf-protection=none
> >
> >  CFLAGS-tst-shstk-legacy-1a.c += -fcf-protection=none
> >  CFLAGS-tst-shstk-legacy-1a-static.c += -fcf-protection=none
> > diff --git a/sysdeps/x86/tst-cet-legacy-10a-static.c b/sysdeps/x86/tst-cet-legacy-10a-static.c
> > new file mode 100644
> > index 0000000000..05073a5d1e
> > --- /dev/null
> > +++ b/sysdeps/x86/tst-cet-legacy-10a-static.c
> > @@ -0,0 +1,2 @@
> > +#pragma GCC target ("shstk")
> > +#include "tst-cet-legacy-10.c"
> > diff --git a/sysdeps/x86/tst-cet-legacy-10a.c b/sysdeps/x86/tst-cet-legacy-10a.c
> > new file mode 100644
> > index 0000000000..05073a5d1e
> > --- /dev/null
> > +++ b/sysdeps/x86/tst-cet-legacy-10a.c
> > @@ -0,0 +1,2 @@
> > +#pragma GCC target ("shstk")
> > +#include "tst-cet-legacy-10.c"
> > --
> > 2.43.0
> >
diff mbox series

Patch

diff --git a/sysdeps/x86/Makefile b/sysdeps/x86/Makefile
index dea14e343c..580c3ecdc5 100644
--- a/sysdeps/x86/Makefile
+++ b/sysdeps/x86/Makefile
@@ -126,8 +126,10 @@  tests += tst-cet-legacy-1 tst-cet-legacy-1a tst-cet-legacy-2 \
 	 tst-cet-legacy-2a tst-cet-legacy-3 tst-cet-legacy-4 \
 	 tst-cet-legacy-5a tst-cet-legacy-6a tst-cet-legacy-7 \
 	 tst-cet-legacy-8 tst-cet-legacy-9 tst-cet-legacy-9-static \
-	 tst-cet-legacy-10 tst-cet-legacy-10-static
-tests-static += tst-cet-legacy-9-static tst-cet-legacy-10-static
+	 tst-cet-legacy-10 tst-cet-legacy-10-static \
+	 tst-cet-legacy-10a tst-cet-legacy-10a-static
+tests-static += tst-cet-legacy-9-static tst-cet-legacy-10-static \
+		tst-cet-legacy-10a-static
 tst-cet-legacy-1a-ARGS = -- $(host-test-program-cmd)
 
 tests += \
@@ -182,6 +184,8 @@  CFLAGS-tst-cet-legacy-mod-6c.c += -fcf-protection
 CFLAGS-tst-cet-legacy-7.c += -fcf-protection=none
 CFLAGS-tst-cet-legacy-10.c += -mshstk
 CFLAGS-tst-cet-legacy-10-static.c += -mshstk
+CFLAGS-tst-cet-legacy-10a.c += -fcf-protection=none
+CFLAGS-tst-cet-legacy-10a-static.c += -fcf-protection=none
 
 CFLAGS-tst-shstk-legacy-1a.c += -fcf-protection=none
 CFLAGS-tst-shstk-legacy-1a-static.c += -fcf-protection=none
diff --git a/sysdeps/x86/tst-cet-legacy-10a-static.c b/sysdeps/x86/tst-cet-legacy-10a-static.c
new file mode 100644
index 0000000000..05073a5d1e
--- /dev/null
+++ b/sysdeps/x86/tst-cet-legacy-10a-static.c
@@ -0,0 +1,2 @@ 
+#pragma GCC target ("shstk")
+#include "tst-cet-legacy-10.c"
diff --git a/sysdeps/x86/tst-cet-legacy-10a.c b/sysdeps/x86/tst-cet-legacy-10a.c
new file mode 100644
index 0000000000..05073a5d1e
--- /dev/null
+++ b/sysdeps/x86/tst-cet-legacy-10a.c
@@ -0,0 +1,2 @@ 
+#pragma GCC target ("shstk")
+#include "tst-cet-legacy-10.c"