This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug dynamic-link/23716] New: _dl_runtime_resolve_shstk isn't selected properly


https://sourceware.org/bugzilla/show_bug.cgi?id=23716

            Bug ID: 23716
           Summary: _dl_runtime_resolve_shstk isn't selected properly
           Product: glibc
           Version: 2.28
            Status: NEW
          Severity: normal
          Priority: P2
         Component: dynamic-link
          Assignee: unassigned at sourceware dot org
          Reporter: hjl.tools at gmail dot com
  Target Milestone: ---
            Target: i386

sysdeps/i386/dl-cet.c has


#ifdef SHARED
void
_dl_cet_check (struct link_map *main_map, const char *program)
{
  cet_check (main_map, program);

  if ((GL(dl_x86_feature_1)[0] & GNU_PROPERTY_X86_FEATURE_1_SHSTK))
    {
      /* Replace _dl_runtime_resolve and _dl_runtime_profile with
         _dl_runtime_resolve_shstk and _dl_runtime_profile_shstk,
         respectively if SHSTK is enabled.  */
      extern void _dl_runtime_resolve (Elf32_Word) attribute_hidden;
      extern void _dl_runtime_resolve_shstk (Elf32_Word) attribute_hidden;
      extern void _dl_runtime_profile (Elf32_Word) attribute_hidden;
      extern void _dl_runtime_profile_shstk (Elf32_Word) attribute_hidden;
      unsigned int i;
      struct link_map *l;
      Elf32_Addr *got;

      if (main_map->l_info[DT_JMPREL])
        {
          got = (Elf32_Addr *) D_PTR (main_map, l_info[DT_PLTGOT]);
          if (got[2] == (Elf32_Addr) &_dl_runtime_resolve)
            got[2] = (Elf32_Addr) &_dl_runtime_resolve_shstk;
          else if (got[2] == (Elf32_Addr) &_dl_runtime_profile)
            got[2] = (Elf32_Addr) &_dl_runtime_profile_shstk;
        }

      i = main_map->l_searchlist.r_nlist;
      while (i-- > 0)
        {
          l = main_map->l_initfini[i];
          if (l->l_info[DT_JMPREL])
            {
              got = (Elf32_Addr *) D_PTR (l, l_info[DT_PLTGOT]);
              if (got[2] == (Elf32_Addr) &_dl_runtime_resolve)
                got[2] = (Elf32_Addr) &_dl_runtime_resolve_shstk;
              else if (got[2] == (Elf32_Addr) &_dl_runtime_profile)
                got[2] = (Elf32_Addr) &_dl_runtime_profile_shstk;
            }
        }
    }
}
#endif

But _dl_cet_check is called before elf_machine_runtime_setup is called.
elf_machine_runtime_setup should select _dl_runtime_resolve_shstk if SHSTK
is enabled.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]