This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: ping: [patch 1/6] PIE: Attach binary even after re-prelinked underneath
- From: Joel Brobecker <brobecker at adacore dot com>
- To: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Mon, 5 Jul 2010 10:06:02 -0700
- Subject: Re: ping: [patch 1/6] PIE: Attach binary even after re-prelinked underneath
- References: <20100329153031.GA31671@host0.dyn.jankratochvil.net> <20100609150753.GA7183@host0.dyn.jankratochvil.net> <20100629174216.GR2595@adacore.com> <20100704101635.GA6875@host0.dyn.jankratochvil.net>
> gdb/
> 2010-07-02 Jan Kratochvil <jan.kratochvil@redhat.com>
> Joel Brobecker <brobecker@adacore.com>
>
> Fix attaching to PIEs prelinked on the disk after the process was
> started.
> * solib-svr4.c (svr4_exec_displacement): New variable arch_size.
> Verify it against bfd_get_arch_size. Try to match arbitrary
> displacement for the phdrs comparison.
>
> gdb/testsuite/
> 2010-07-02 Jan Kratochvil <jan.kratochvil@redhat.com>
> Joel Brobecker <brobecker@adacore.com>
>
> * gdb.base/break-interp.exp: Run $binpie with new value "ATTACH", new
> code for it. New variable relink_args.
> (prelinkYES): Call prelinkNO.
> (test_attach): Accept new parameter relink_args. Re-prelink the binary
> in such case. Move the core code to ...
> (test_attach_gdb): ... a new function. Send GDB command "file".
> Extend expected "Attaching to " string.
This is OK, with one English error in one of my suggestions (mea culpa).
I also still have a question, but this should not prevent the patch to
go in as is.
> + /* DISPLACEMENT could be found easier by the difference of
^^^^^^ more easily
Same thing for the 64bit case.
> + /* PT_GNU_STACK is an exception by being never relocated by
> + prelink as its addresses are always zero. */
I understand why you mean, now, about the PT_GNU_STACK entry not being
changed during the prelink. But I don't get the relationship between
this comment and the code surrounding it. Can you explain that?
--
Joel