This is the mail archive of the binutils@sourceware.org mailing list for the binutils 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]

RE: Debugging MIPS PIE executables


Felix Radensky <felix.radensky@broadcom.com> writes:
> Hi Matthew,
> 
> > -----Original Message-----
> > From: Matthew Fortune [mailto:Matthew.Fortune@imgtec.com]
> > Sent: Sunday, June 07, 2015 11:10 AM
> > To: Felix Radensky; binutils@sourceware.org
> > Subject: RE: Debugging MIPS PIE executables
> >
> > Hi Felix,
> >
> > Felix Radensky <felix.radensky@broadcom.com> writes:
> > > I was wondering if any progress was made to resolve the problem
> > > discussed in the following threads:
> > >
> > > https://sourceware.org/ml/binutils/2013-06/msg00183.html
> > > https://sourceware.org/ml/binutils/2014-10/msg00200.html
> > >
> > > Are there any experimental patches for binutils/gdb/glibc that I
> can
> > > try ? PIE executables are must in many security-conscious projects,
> > > and the lack of ability to debug them is a serious problem.
> >
> > This request has come up a few times again recently and I am hoping
> to
> > submit patches for this in the coming week. I still have not managed
> > to build a PIE version of glibc which is a bit of a blocker. I'm
> > currently trying to use HJ's recent patches to support PIE by default
> > from GCC but now have link assertions in glibc instead of reloc
> failures.
> >
> > I have binutils and gdb patches that have been used with bionic but
> > they still need some cleaning up.
> 
> Thanks a lot for a prompt reply. I'm looking forward to test your
> patches.

I've attached the patches I intend to submit but I still have to work
through the binutils testsuite to account for the new tag and try to
write a useful test case. I'll also need to get advice on doing a GDB
test for this as I don't know if/how to do that.

The patches are manually tested for o32/n32/n64 PIE and ordinary
executables with the expected behaviour that new PIEs with new ld.so
show the correct library list.

I'm travelling on business for the next week so may not be able to get
through the testing part of this. Let me know if you find any issues
with these.

The solution involves a new tag and is un-inventively called:

DT_MIPS_RLD_MAP2 - 0x70000035

Definition:

This member is used by debugging.  It contains a relative
offset from the tag's runtime location of a 32-bit word in the
.data section which is supplied by the compilation environment.
The word's contents are not specified and programs using this value
are not ABI - compliant.

I have considered the suggestion from Roland and Maciej about
making this a GNU tag. MIPS needs this feature because of the way
the psABI is defined and will therefore need this for any OS
which may well then lead to needing more tags. If the tag were in
the completely generic range (like DT_DEBUG) then I wouldn't be
concerned at all.

Thanks,
Matthew



Attachment: binutils.patch
Description: binutils.patch

Attachment: gdb.patch
Description: gdb.patch

Attachment: glibc.patch
Description: glibc.patch


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