|
Packit Bot |
0c2104 |
/* Linux/i386 CET initializers function.
|
|
Packit Bot |
0c2104 |
Copyright (C) 2018 Free Software Foundation, Inc.
|
|
Packit Bot |
0c2104 |
|
|
Packit Bot |
0c2104 |
The GNU C Library is free software; you can redistribute it and/or
|
|
Packit Bot |
0c2104 |
modify it under the terms of the GNU Lesser General Public
|
|
Packit Bot |
0c2104 |
License as published by the Free Software Foundation; either
|
|
Packit Bot |
0c2104 |
version 2.1 of the License, or (at your option) any later version.
|
|
Packit Bot |
0c2104 |
|
|
Packit Bot |
0c2104 |
The GNU C Library is distributed in the hope that it will be useful,
|
|
Packit Bot |
0c2104 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Bot |
0c2104 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit Bot |
0c2104 |
Lesser General Public License for more details.
|
|
Packit Bot |
0c2104 |
|
|
Packit Bot |
0c2104 |
You should have received a copy of the GNU Lesser General Public
|
|
Packit Bot |
0c2104 |
License along with the GNU C Library; if not, see
|
|
Packit Bot |
0c2104 |
<http://www.gnu.org/licenses/>. */
|
|
Packit Bot |
0c2104 |
|
|
Packit Bot |
0c2104 |
|
|
Packit Bot |
0c2104 |
#define LINKAGE static inline
|
|
Packit Bot |
0c2104 |
#define _dl_cet_check cet_check
|
|
Packit Bot |
0c2104 |
#include <sysdeps/x86/dl-cet.c>
|
|
Packit Bot |
0c2104 |
#undef _dl_cet_check
|
|
Packit Bot |
0c2104 |
|
|
Packit Bot |
0c2104 |
#ifdef SHARED
|
|
Packit Bot |
0c2104 |
void
|
|
Packit Bot |
0c2104 |
_dl_cet_check (struct link_map *main_map, const char *program)
|
|
Packit Bot |
0c2104 |
{
|
|
Packit Bot |
0c2104 |
cet_check (main_map, program);
|
|
Packit Bot |
0c2104 |
|
|
Packit Bot |
0c2104 |
if ((GL(dl_x86_feature_1)[0] & GNU_PROPERTY_X86_FEATURE_1_SHSTK))
|
|
Packit Bot |
0c2104 |
{
|
|
Packit Bot |
0c2104 |
/* Replace _dl_runtime_resolve and _dl_runtime_profile with
|
|
Packit Bot |
0c2104 |
_dl_runtime_resolve_shstk and _dl_runtime_profile_shstk,
|
|
Packit Bot |
0c2104 |
respectively if SHSTK is enabled. */
|
|
Packit Bot |
0c2104 |
extern void _dl_runtime_resolve (Elf32_Word) attribute_hidden;
|
|
Packit Bot |
0c2104 |
extern void _dl_runtime_resolve_shstk (Elf32_Word) attribute_hidden;
|
|
Packit Bot |
0c2104 |
extern void _dl_runtime_profile (Elf32_Word) attribute_hidden;
|
|
Packit Bot |
0c2104 |
extern void _dl_runtime_profile_shstk (Elf32_Word) attribute_hidden;
|
|
Packit Bot |
0c2104 |
unsigned int i;
|
|
Packit Bot |
0c2104 |
struct link_map *l;
|
|
Packit Bot |
0c2104 |
Elf32_Addr *got;
|
|
Packit Bot |
0c2104 |
|
|
Packit Bot |
0c2104 |
if (main_map->l_info[DT_JMPREL])
|
|
Packit Bot |
0c2104 |
{
|
|
Packit Bot |
0c2104 |
got = (Elf32_Addr *) D_PTR (main_map, l_info[DT_PLTGOT]);
|
|
Packit Bot |
0c2104 |
if (got[2] == (Elf32_Addr) &_dl_runtime_resolve)
|
|
Packit Bot |
0c2104 |
got[2] = (Elf32_Addr) &_dl_runtime_resolve_shstk;
|
|
Packit Bot |
0c2104 |
else if (got[2] == (Elf32_Addr) &_dl_runtime_profile)
|
|
Packit Bot |
0c2104 |
got[2] = (Elf32_Addr) &_dl_runtime_profile_shstk;
|
|
Packit Bot |
0c2104 |
}
|
|
Packit Bot |
0c2104 |
|
|
Packit Bot |
0c2104 |
i = main_map->l_searchlist.r_nlist;
|
|
Packit Bot |
0c2104 |
while (i-- > 0)
|
|
Packit Bot |
0c2104 |
{
|
|
Packit Bot |
0c2104 |
l = main_map->l_initfini[i];
|
|
Packit Bot |
0c2104 |
if (l->l_info[DT_JMPREL])
|
|
Packit Bot |
0c2104 |
{
|
|
Packit Bot |
0c2104 |
got = (Elf32_Addr *) D_PTR (l, l_info[DT_PLTGOT]);
|
|
Packit Bot |
0c2104 |
if (got[2] == (Elf32_Addr) &_dl_runtime_resolve)
|
|
Packit Bot |
0c2104 |
got[2] = (Elf32_Addr) &_dl_runtime_resolve_shstk;
|
|
Packit Bot |
0c2104 |
else if (got[2] == (Elf32_Addr) &_dl_runtime_profile)
|
|
Packit Bot |
0c2104 |
got[2] = (Elf32_Addr) &_dl_runtime_profile_shstk;
|
|
Packit Bot |
0c2104 |
}
|
|
Packit Bot |
0c2104 |
}
|
|
Packit Bot |
0c2104 |
}
|
|
Packit Bot |
0c2104 |
}
|
|
Packit Bot |
0c2104 |
#endif
|