This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH 04/23] x86: Add _CET_ENDBR to functions in crti.S
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: libc-alpha at sourceware dot org
- Cc: Carlos O'Donell <carlos at redhat dot com>
- Date: Tue, 8 May 2018 13:40:02 -0700
- Subject: [PATCH 04/23] x86: Add _CET_ENDBR to functions in crti.S
- References: <20180508204021.31845-1-hjl.tools@gmail.com>
Add _CET_ENDBR to functions in crti.S, which are called indirectly, to
support IBT.
Tested on i686 and x86-64.
* sysdeps/i386/crti.S (_init): Add _CET_ENDBR.
(_fini): Likewise.
* sysdeps/x86_64/crti.S (_init): Likewise.
(_fini): Likewise.
---
sysdeps/i386/crti.S | 2 ++
sysdeps/x86_64/crti.S | 2 ++
2 files changed, 4 insertions(+)
diff --git a/sysdeps/i386/crti.S b/sysdeps/i386/crti.S
index c0422f9ce3..ad46d30a49 100644
--- a/sysdeps/i386/crti.S
+++ b/sysdeps/i386/crti.S
@@ -60,6 +60,7 @@
.globl _init
.type _init, @function
_init:
+ _CET_ENDBR
pushl %ebx
/* Maintain 16-byte stack alignment for called functions. */
subl $8, %esp
@@ -79,6 +80,7 @@ _init:
.globl _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 619effac3a..de0d87f1c9 100644
--- a/sysdeps/x86_64/crti.S
+++ b/sysdeps/x86_64/crti.S
@@ -60,6 +60,7 @@
.globl _init
.type _init, @function
_init:
+ _CET_ENDBR
/* Maintain 16-byte stack alignment for called functions. */
subq $8, %rsp
#if PREINIT_FUNCTION_WEAK
@@ -77,4 +78,5 @@ _init:
.globl _fini
.type _fini, @function
_fini:
+ _CET_ENDBR
subq $8, %rsp
--
2.17.0