This is the mail archive of the
glibc-cvs@sourceware.org
mailing list for the glibc project.
GNU C Library master sources branch hjl/cet/property created. glibc-2.25-549-g0e00807
- From: hjl at sourceware dot org
- To: glibc-cvs at sourceware dot org
- Date: 22 Jun 2017 13:15:15 -0000
- Subject: GNU C Library master sources branch hjl/cet/property created. glibc-2.25-549-g0e00807
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".
The branch, hjl/cet/property has been created
at 0e00807cc46ff4a5af813ad618280fa0d7cca2e2 (commit)
- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=0e00807cc46ff4a5af813ad618280fa0d7cca2e2
commit 0e00807cc46ff4a5af813ad618280fa0d7cca2e2
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Thu Jun 22 04:15:39 2017 -0700
Add --enable-cet to configure and <sys/cet.h>
Add --enable-cet to glibc configure to enable CET, which includes
sysdeps/unix/sysv/linux/x86/sys/cet.h for assembly and C sources so
that ELF program property can be added to all relocatable objects.
If compiler defines__IBT__, the IBT bit is turned on in x86 feature.
If compiler defines __SHSTK__, the SHSTK bit is turned on in x86
feature.
* configure.ac: Add --enable-cet.
(enable-cet): New LIBC_CONFIG_VAR.
* configure: Regenerated.
* sysdeps/unix/sysv/linux/x86/Makefile (CPPFLAGS-.o): Add
-include $(..)sysdeps/unix/sysv/linux/x86/sys/cet.h.
(CPPFLAGS-.os): Likewise.
(CPPFLAGS-.op): Likewise.
* sysdeps/unix/sysv/linux/x86/sys/cet.h: New file.
diff --git a/configure b/configure
index 97a2dad..5ac2c78 100755
--- a/configure
+++ b/configure
@@ -788,6 +788,7 @@ enable_nscd
enable_pt_chown
enable_tunables
enable_mathvec
+enable_cet
with_cpu
'
ac_precious_vars='build_alias
@@ -1463,6 +1464,7 @@ Optional Features:
'no' and 'valstring'
--enable-mathvec Enable building and installing mathvec [default
depends on architecture]
+ --enable-cet Enable CET [default depends on architecture]
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@@ -3754,6 +3756,14 @@ else
fi
+# Check whether --enable-cet was given.
+if test "${enable_cet+set}" = set; then :
+ enableval=$enable_cet; enable_cet=$enableval
+else
+ enable_cet=notset
+fi
+
+
# We keep the original values in `$config_*' and never modify them, so we
# can write them unchanged into config.make. Everything else uses
# $machine, $vendor, and $os, and changes them whenever convenient.
@@ -6682,6 +6692,12 @@ fi
config_vars="$config_vars
build-mathvec = $build_mathvec"
+if test x"$enable_cet" = xnotset; then
+ enable_cet=no
+fi
+config_vars="$config_vars
+enable-cet = $enable_cet"
+
diff --git a/configure.ac b/configure.ac
index 16e97d3..29a2e36 100644
--- a/configure.ac
+++ b/configure.ac
@@ -460,6 +460,12 @@ AC_ARG_ENABLE([mathvec],
[build_mathvec=$enableval],
[build_mathvec=notset])
+AC_ARG_ENABLE([cet],
+ [AS_HELP_STRING([--enable-cet],
+ [Enable CET @<:@default depends on architecture@:>@])],
+ [enable_cet=$enableval],
+ [enable_cet=notset])
+
# We keep the original values in `$config_*' and never modify them, so we
# can write them unchanged into config.make. Everything else uses
# $machine, $vendor, and $os, and changes them whenever convenient.
@@ -1855,6 +1861,11 @@ if test x"$build_mathvec" = xnotset; then
fi
LIBC_CONFIG_VAR([build-mathvec], [$build_mathvec])
+if test x"$enable_cet" = xnotset; then
+ enable_cet=no
+fi
+LIBC_CONFIG_VAR([enable-cet], [$enable_cet])
+
AC_SUBST(libc_extra_cflags)
AC_SUBST(libc_extra_cppflags)
diff --git a/sysdeps/unix/sysv/linux/x86/Makefile b/sysdeps/unix/sysv/linux/x86/Makefile
index 9e6ec44..71225bb 100644
--- a/sysdeps/unix/sysv/linux/x86/Makefile
+++ b/sysdeps/unix/sysv/linux/x86/Makefile
@@ -22,3 +22,9 @@ endif
ifeq ($(subdir),elf)
sysdep_routines += dl-vdso
endif
+
+ifeq ($(enable-cet),yes)
+CPPFLAGS-.o += -include $(..)sysdeps/unix/sysv/linux/x86/sys/cet.h
+CPPFLAGS-.os += -include $(..)sysdeps/unix/sysv/linux/x86/sys/cet.h
+CPPFLAGS-.op += -include $(..)sysdeps/unix/sysv/linux/x86/sys/cet.h
+endif
diff --git a/sysdeps/unix/sysv/linux/x86/sys/cet.h b/sysdeps/unix/sysv/linux/x86/sys/cet.h
new file mode 100644
index 0000000..80f10cf
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86/sys/cet.h
@@ -0,0 +1,142 @@
+/* GNU program property for Intel CET.
+ Copyright (C) 2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _SYS_CET_H
+#define _SYS_CET_H 1
+
+# ifdef __ASSEMBLER__
+
+# ifdef __LP64__
+# define __PROPERTY_ALIGN 3
+# else
+# define __PROPERTY_ALIGN 2
+# endif
+
+# ifdef __IBT__
+/* Turn on IBT in x86 feature. */
+
+ .pushsection ".note.gnu.property", "a"
+ .p2align __PROPERTY_ALIGN
+ .long 1f - 0f /* name length. */
+ .long 5f - 1f /* data length. */
+ /* NT_GNU_PROPERTY_TYPE_0. */
+ .long 5 /* note type. */
+0:
+ .asciz "GNU" /* vendor name. */
+1:
+ .p2align __PROPERTY_ALIGN
+ /* GNU_PROPERTY_X86_FEATURE_1_AND. */
+ .long 0xc0000002 /* pr_type. */
+ .long 4f - 3f /* pr_datasz. */
+3:
+ /* GNU_PROPERTY_X86_FEATURE_1_IBT. */
+ .long 0x1
+4:
+ .p2align __PROPERTY_ALIGN
+5:
+ .popsection
+# endif
+
+# ifdef __SHSTK__
+/* Turn on SHSTK in x86 feature. */
+
+ .pushsection ".note.gnu.property", "a"
+ .p2align __PROPERTY_ALIGN
+ .long 1f - 0f /* name length. */
+ .long 5f - 1f /* data length. */
+ /* NT_GNU_PROPERTY_TYPE_0. */
+ .long 5 /* note type. */
+0:
+ .asciz "GNU" /* vendor name. */
+1:
+ .p2align __PROPERTY_ALIGN
+ /* GNU_PROPERTY_X86_FEATURE_1_AND. */
+ .long 0xc0000002 /* pr_type. */
+ .long 4f - 3f /* pr_datasz. */
+3:
+ /* GNU_PROPERTY_X86_FEATURE_1_SHSTK. */
+ .long 0x2
+4:
+ .p2align __PROPERTY_ALIGN
+5:
+ .popsection
+# endif
+
+# else
+
+# ifdef __LP64__
+# define __PROPERTY_ALIGN "3"
+# else
+# define __PROPERTY_ALIGN "2"
+# endif
+
+# ifdef __IBT__
+/* Turn on IBT in x86 feature. */
+
+ __asm ("\
+ .pushsection \".note.gnu.property\", \"a\"\n\
+ .p2align " __PROPERTY_ALIGN "\n\
+ .long 1f - 0f /* name length. */\n\
+ .long 5f - 1f /* data length. */\n\
+ /* NT_GNU_PROPERTY_TYPE_0. */\n\
+ .long 5 /* note type. */\n\
+0:\n\
+ .asciz \"GNU\" /* vendor name. */\n\
+1:\n\
+ .p2align " __PROPERTY_ALIGN "\n\
+ /* GNU_PROPERTY_X86_FEATURE_1_AND. */\n\
+ .long 0xc0000002 /* pr_type. */\n\
+ .long 4f - 3f /* pr_datasz. */\n\
+3:\n\
+ /* GNU_PROPERTY_X86_FEATURE_1_IBT. */\n\
+ .long 0x1\n\
+4:\n\
+ .p2align " __PROPERTY_ALIGN "\n\
+5:\n\
+ .popsection");
+# endif
+
+# ifdef __SHSTK__
+/* Turn on SHSTK in x86 feature. */
+
+ __asm ("\
+ .pushsection \".note.gnu.property\", \"a\"\n\
+ .p2align " __PROPERTY_ALIGN "\n\
+ .long 1f - 0f /* name length. */\n\
+ .long 5f - 1f /* data length. */\n\
+ /* NT_GNU_PROPERTY_TYPE_0. */\n\
+ .long 5 /* note type. */\n\
+0:\n\
+ .asciz \"GNU\" /* vendor name. */\n\
+1:\n\
+ .p2align " __PROPERTY_ALIGN "\n\
+ /* GNU_PROPERTY_X86_FEATURE_1_AND. */\n\
+ .long 0xc0000002 /* pr_type. */\n\
+ .long 4f - 3f /* pr_datasz. */\n\
+3:\n\
+ /* GNU_PROPERTY_X86_FEATURE_1_SHSTK. */\n\
+ .long 0x2\n\
+4:\n\
+ .p2align " __PROPERTY_ALIGN "\n\
+5:\n\
+ .popsection");
+# endif
+
+# endif
+
+#endif /* _SYS_CET_H */
-----------------------------------------------------------------------
hooks/post-receive
--
GNU C Library master sources