i386: Add _CET_ENDBR to indirect jump targets in add_n.S/sub_n.S
commitbe9ccd27c09ee76c5397125bfa0fefae318a2996
authorH.J. Lu <hjl.tools@gmail.com>
Tue, 17 Jul 2018 23:11:13 +0000 (17 16:11 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Tue, 17 Jul 2018 23:11:44 +0000 (17 16:11 -0700)
treefedd9f2980ad4b1d2afd66a83032dc317d253bd3
parent5efc6777ad57c2055b618e0b8b8dc1e5bc4ab29a
i386: Add _CET_ENDBR to indirect jump targets in add_n.S/sub_n.S

i386 add_n.S and sub_n.S use a trick to implment jump tables with LEA.
We can't use conditional branches nor normal jump tables since jump
table entries use EFLAGS set by jump table index.  This patch adds
_CET_ENDBR to indirect jump targets and adjust destination for
_CET_ENDBR.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* sysdeps/i386/add_n.S: Include <sysdep.h>, instead of
"sysdep.h".
(__mpn_add_n): Save and restore %ebx if IBT is enabed.  Add
_CET_ENDBR to indirect jump targets and adjust jump destination
for _CET_ENDBR.
* sysdeps/i386/i686/add_n.S: Include <sysdep.h>, instead of
"sysdep.h".
(__mpn_add_n): Save and restore %ebx if IBT is enabed.  Add
_CET_ENDBR to indirect jump targets and adjust jump destination
for _CET_ENDBR.
* sysdeps/i386/sub_n.S: Include <sysdep.h>, instead of
"sysdep.h".
(__mpn_sub_n): Save and restore %ebx if IBT is enabed.  Add
_CET_ENDBR to indirect jump targets and adjust jump destination
for _CET_ENDBR.
ChangeLog
sysdeps/i386/add_n.S
sysdeps/i386/i686/add_n.S
sysdeps/i386/sub_n.S