From: H.J. Lu Date: Tue, 17 Jul 2018 23:04:41 +0000 (-0700) Subject: x86: Add _CET_ENDBR to functions in crti.S X-Git-Tag: glibc-2.28~92 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=124bcde683;p=thirdparty%2Fglibc.git 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 * sysdeps/i386/crti.S (_init): Add _CET_ENDBR. (_fini): Likewise. * sysdeps/x86_64/crti.S (_init): Likewise. (_fini): Likewise. --- diff --git a/ChangeLog b/ChangeLog index 694d10f0840..59ed8bfa525 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2018-07-17 H.J. Lu + + * sysdeps/i386/crti.S (_init): Add _CET_ENDBR. + (_fini): Likewise. + * sysdeps/x86_64/crti.S (_init): Likewise. + (_fini): Likewise. + 2018-07-17 Rafal Luzynski [BZ #23140] diff --git a/sysdeps/i386/crti.S b/sysdeps/i386/crti.S index ffbc92c22f2..65ddc1c934b 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 f26915e9560..067ac148843 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