This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB 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 symtab/21126] New: PIE displacement check needs to handle fully NULL'd GNU_RELRO


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

            Bug ID: 21126
           Summary: PIE displacement check needs to handle fully NULL'd
                    GNU_RELRO
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: symtab
          Assignee: unassigned at sourceware dot org
          Reporter: dje at google dot com
  Target Milestone: ---

Evidently strip is now fully NULLing out PT_GNU_RELRO segments (as in even the
segment type is changed to PT_NULL).

svr4_exec_displacement needs to be updated to handle this.

There's no real reason to compare absolutely every segment header in this
sanity check (see svr4_exec_displacement), and the cost to the user of
accidentally getting it wrong is severe (completely unusable debug session).
I think it would be better to let the test pass with a loud warning than to
fail.
[Setting aside a better test which is to just compare the build ids.]

See also PR 11786.

                  /* Strip modifies the flags and alignment of PT_GNU_RELRO.    
                     CentOS-5 has problems with filesz, memsz as well.          
                     See PR 11786.  */
                  if (phdr2[i].p_type == PT_GNU_RELRO)
                    {
                      Elf64_External_Phdr tmp_phdr = *phdrp;
                      Elf64_External_Phdr tmp_phdr2 = *phdr2p;

                      memset (tmp_phdr.p_filesz, 0, 8);
                      memset (tmp_phdr.p_memsz, 0, 8);
                      memset (tmp_phdr.p_flags, 0, 4);
                      memset (tmp_phdr.p_align, 0, 8);
                      memset (tmp_phdr2.p_filesz, 0, 8);
                      memset (tmp_phdr2.p_memsz, 0, 8);
                      memset (tmp_phdr2.p_flags, 0, 4);
                      memset (tmp_phdr2.p_align, 0, 8);

                      if (memcmp (&tmp_phdr, &tmp_phdr2, sizeof (tmp_phdr))
                          == 0)
                        continue;
                    }

-- 
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]