about summary refs log tree commit diff
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2018-07-17 16:04:41 -0700
committerH.J. Lu <hjl.tools@gmail.com>2018-07-17 16:05:18 -0700
commit124bcde683d5d8b5c26bd2f535edcf3b7ab6108c (patch)
tree2a5d04ec0beca2b81243a04cfe8bbdc77e1210e6
parent9145f0333d11683cb3d796246d1395c84b4a3516 (diff)
downloadglibc-124bcde683d5d8b5c26bd2f535edcf3b7ab6108c.tar.gz
glibc-124bcde683d5d8b5c26bd2f535edcf3b7ab6108c.tar.xz
glibc-124bcde683d5d8b5c26bd2f535edcf3b7ab6108c.zip
x86: Add _CET_ENDBR to functions in crti.S
Add _CET_ENDBR to functions in crti.S, which are called indirectly, to
support IBT.

Tested on i686 and x86-64.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>

	* sysdeps/i386/crti.S (_init): Add _CET_ENDBR.
	(_fini): Likewise.
	* sysdeps/x86_64/crti.S (_init): Likewise.
	(_fini): Likewise.
-rw-r--r--ChangeLog7
-rw-r--r--sysdeps/i386/crti.S2
-rw-r--r--sysdeps/x86_64/crti.S2
3 files changed, 11 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 694d10f084..59ed8bfa52 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2018-07-17  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* sysdeps/i386/crti.S (_init): Add _CET_ENDBR.
+	(_fini): Likewise.
+	* sysdeps/x86_64/crti.S (_init): Likewise.
+	(_fini): Likewise.
+
 2018-07-17  Rafal Luzynski  <digitalfreak@lingonborough.com>
 
 	[BZ #23140]
diff --git a/sysdeps/i386/crti.S b/sysdeps/i386/crti.S
index ffbc92c22f..65ddc1c934 100644
--- a/sysdeps/i386/crti.S
+++ b/sysdeps/i386/crti.S
@@ -61,6 +61,7 @@
 	.hidden	_init
 	.type _init, @function
 _init:
+	_CET_ENDBR
 	pushl %ebx
 	/* Maintain 16-byte stack alignment for called functions.  */
 	subl $8, %esp
@@ -81,6 +82,7 @@ _init:
 	.hidden	_fini
 	.type _fini, @function
 _fini:
+	_CET_ENDBR
 	pushl %ebx
 	subl $8, %esp
 	LOAD_PIC_REG (bx)
diff --git a/sysdeps/x86_64/crti.S b/sysdeps/x86_64/crti.S
index f26915e956..067ac14884 100644
--- a/sysdeps/x86_64/crti.S
+++ b/sysdeps/x86_64/crti.S
@@ -61,6 +61,7 @@
 	.hidden	_init
 	.type _init, @function
 _init:
+	_CET_ENDBR
 	/* Maintain 16-byte stack alignment for called functions.  */
 	subq $8, %rsp
 #if PREINIT_FUNCTION_WEAK
@@ -79,4 +80,5 @@ _init:
 	.hidden	_fini
 	.type _fini, @function
 _fini:
+	_CET_ENDBR
 	subq $8, %rsp