* [patch] Sanity check PIE displacement (like the PIC one)
@ 2010-02-01 1:20 Jan Kratochvil
2010-02-11 16:37 ` [ping] " Jan Kratochvil
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Jan Kratochvil @ 2010-02-01 1:20 UTC (permalink / raw)
To: gdb-patches
Hi,
there is a regression-like problem from the PIE patchset:
[RFC/ia64] memory error when reading wrong core file
http://sourceware.org/ml/gdb-patches/2010-01/msg00645.html
which reminded me the PIE displacement should be considered as valid only
under some circumstances similar to the PIC ones. The PIC displacement is
already being sanity checked since its beginning:
cope with varying prelink base addresses
http://sourceware.org/ml/gdb-patches/2006-02/msg00164.html
http://sourceware.org/ml/gdb-cvs/2006-02/msg00133.html
http://sourceware.org/ml/gdb-cvs/2006-02/msg00134.html
9d3251335df19906ffbf861c40199c7e28af3e7a
->
((l_addr & align) == 0 && ((dynaddr - l_dynaddr) & align) == 0)
while the specific condition there was later relaxed by:
[rfa] Fix detection of prelinked libraries on PPC
http://sourceware.org/ml/gdb-patches/2007-07/msg00109.html
http://sourceware.org/ml/gdb-cvs/2007-07/msg00055.html
fc5294c8de7ee77ec3ed9e0ca2dff670d0e7789f
->
((l_addr & align) == ((l_dynaddr - dynaddr) & align))
No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu. It has some
mi* regressions in PIE mode (check//unix/-fPIE/-pie) due to the new message
printed for PIE. If the message gets approved I will update the testcases.
The current PIC message being printed "all the time" is:
warning: .dynamic section for "/lib64/librt-2.11.1.so" is not at the expected address
warning: difference appears to be caused by prelink, adjusting expectations
The PIE message should be IMO printed iff te PIC message is printed (although
the PIC message is printed only if the prelink state changes vs. PIE message
is printed on each load of a PIE executable). I do not find the current PIC
message too useful (moreover without any offset printed). Therefore I am open
to removing both the PIC (and new PIE) messages when the offset is successfuly
considered as valid.
The patch also extends LM_ADDR_CHECK. This can be considered a separate patch
part with possible independency of approval. The topic is the same so I have
posted it together.
Thanks,
Jan
2010-02-01 Jan Kratochvil <jan.kratochvil@redhat.com>
* solib-svr4.c (LM_ADDR_CHECK): Move variable align to a more inner
block. New variable minpagesize, set it for ELF ABFDs. New comment on
PPC-aware condition. Extend the condition using MINPAGESIZE.
(svr4_exec_displacement): New variable retval. Sanity check it.
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -176,7 +176,7 @@ LM_ADDR_CHECK (struct so_list *so, bfd *abfd)
if (so->lm_info->l_addr == (CORE_ADDR)-1)
{
struct bfd_section *dyninfo_sect;
- CORE_ADDR l_addr, l_dynaddr, dynaddr, align = 0x1000;
+ CORE_ADDR l_addr, l_dynaddr, dynaddr;
l_addr = LM_ADDR_FROM_LINK_MAP (so);
@@ -193,6 +193,9 @@ LM_ADDR_CHECK (struct so_list *so, bfd *abfd)
if (dynaddr + l_addr != l_dynaddr)
{
+ CORE_ADDR align = 0x1000;
+ CORE_ADDR minpagesize = align;
+
if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
{
Elf_Internal_Ehdr *ehdr = elf_tdata (abfd)->elf_header;
@@ -204,6 +207,8 @@ LM_ADDR_CHECK (struct so_list *so, bfd *abfd)
for (i = 0; i < ehdr->e_phnum; i++)
if (phdr[i].p_type == PT_LOAD && phdr[i].p_align > align)
align = phdr[i].p_align;
+
+ minpagesize = get_elf_backend_data (abfd)->minpagesize;
}
/* Turn it into a mask. */
@@ -217,8 +222,20 @@ LM_ADDR_CHECK (struct so_list *so, bfd *abfd)
location, or anything, really. To avoid regressions,
don't adjust the base offset in the latter case, although
odds are that, if things really changed, debugging won't
- quite work. */
- if ((l_addr & align) == ((l_dynaddr - dynaddr) & align))
+ quite work.
+
+ One could rather expect the condition
+ ((l_addr & align) == 0 && ((l_dynaddr - dynaddr) & align) == 0)
+ but the one below is relaxed for PPC. The PPC kernel supports
+ either 4k or 64k page sizes. To be prepared for 64k pages,
+ PPC ELF files are built using an alignment requirement of 64k.
+ However, when running on a kernel supporting 4k pages, the memory
+ mapping of the library may not actually happen on a 64k boundary!
+
+ Check at least the MINPAGESIZE alignment still valid on PPC. */
+
+ if ((l_addr & (minpagesize - 1)) == 0
+ && (l_addr & align) == ((l_dynaddr - dynaddr) & align))
{
l_addr = l_dynaddr - dynaddr;
@@ -1629,7 +1646,42 @@ svr4_exec_displacement (void)
return 0;
if (target_auxv_search (¤t_target, AT_ENTRY, &entry_point) == 1)
- return entry_point - bfd_get_start_address (exec_bfd);
+ {
+ CORE_ADDR retval = entry_point - bfd_get_start_address (exec_bfd);
+
+ /* If current executable is not PIE (Position Independent Executable)
+ suppress any messages. */
+ if (retval == 0)
+ return 0;
+
+ if (bfd_get_flavour (exec_bfd) == bfd_target_elf_flavour)
+ {
+ const struct elf_backend_data *elf = get_elf_backend_data (exec_bfd);
+
+ /* Check of the alignment against max (p_align) of PT_LOAD segments
+ cannot be used here as in LM_ADDR_CHECK for PIC libraries as at
+ least amd64 PIE executables have 2MB p_align while Linux kernel
+ loads them with arbitrary 4KB displacement. As in this case there
+ is no LM_ADDR_FROM_LINK_MAP to verify the possible offset GDB has
+ to depend just on MINPAGESIZE. */
+
+ if ((retval & (elf->minpagesize - 1)) != 0)
+ {
+ warning (_("PIE (Position Independent Executable) displacement "
+ "%s is not aligned to the minimal page size %s "
+ "for \"%s\" (wrong executable or version mismatch?)"),
+ paddress (target_gdbarch, retval),
+ paddress (target_gdbarch, elf->minpagesize),
+ bfd_get_filename (exec_bfd));
+ return 0;
+ }
+ }
+
+ warning (_("Using PIE (Position Independent Executable) displacement %s "
+ "for \"%s\""),
+ paddress (target_gdbarch, retval), bfd_get_filename (exec_bfd));
+ return retval;
+ }
return svr4_static_exec_displacement ();
}
^ permalink raw reply [flat|nested] 10+ messages in thread
* [ping] [patch] Sanity check PIE displacement (like the PIC one)
2010-02-01 1:20 [patch] Sanity check PIE displacement (like the PIC one) Jan Kratochvil
@ 2010-02-11 16:37 ` Jan Kratochvil
2010-02-11 19:43 ` Tom Tromey
2010-02-13 20:14 ` [cancelled] " Jan Kratochvil
2 siblings, 0 replies; 10+ messages in thread
From: Jan Kratochvil @ 2010-02-11 16:37 UTC (permalink / raw)
To: gdb-patches
Hi,
ping(gdb-7.1?).
There are some options if it should / should not print some of the messages.
Still at least some form of the svr4_exec_displacement() part should IMO go in
as otherwise there is a regression risk for gdb-7.1.
Thanks,
Jan
------------------------------------------------------------------------------
On Mon, 01 Feb 2010 02:20:04 +0100, Jan Kratochvil wrote:
Hi,
there is a regression-like problem from the PIE patchset:
[RFC/ia64] memory error when reading wrong core file
http://sourceware.org/ml/gdb-patches/2010-01/msg00645.html
which reminded me the PIE displacement should be considered as valid only
under some circumstances similar to the PIC ones. The PIC displacement is
already being sanity checked since its beginning:
cope with varying prelink base addresses
http://sourceware.org/ml/gdb-patches/2006-02/msg00164.html
http://sourceware.org/ml/gdb-cvs/2006-02/msg00133.html
http://sourceware.org/ml/gdb-cvs/2006-02/msg00134.html
9d3251335df19906ffbf861c40199c7e28af3e7a
->
((l_addr & align) == 0 && ((dynaddr - l_dynaddr) & align) == 0)
while the specific condition there was later relaxed by:
[rfa] Fix detection of prelinked libraries on PPC
http://sourceware.org/ml/gdb-patches/2007-07/msg00109.html
http://sourceware.org/ml/gdb-cvs/2007-07/msg00055.html
fc5294c8de7ee77ec3ed9e0ca2dff670d0e7789f
->
((l_addr & align) == ((l_dynaddr - dynaddr) & align))
No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu. It has some
mi* regressions in PIE mode (check//unix/-fPIE/-pie) due to the new message
printed for PIE. If the message gets approved I will update the testcases.
The current PIC message being printed "all the time" is:
warning: .dynamic section for "/lib64/librt-2.11.1.so" is not at the expected address
warning: difference appears to be caused by prelink, adjusting expectations
The PIE message should be IMO printed iff te PIC message is printed (although
the PIC message is printed only if the prelink state changes vs. PIE message
is printed on each load of a PIE executable). I do not find the current PIC
message too useful (moreover without any offset printed). Therefore I am open
to removing both the PIC (and new PIE) messages when the offset is successfuly
considered as valid.
The patch also extends LM_ADDR_CHECK. This can be considered a separate patch
part with possible independency of approval. The topic is the same so I have
posted it together.
Thanks,
Jan
2010-02-01 Jan Kratochvil <jan.kratochvil@redhat.com>
* solib-svr4.c (LM_ADDR_CHECK): Move variable align to a more inner
block. New variable minpagesize, set it for ELF ABFDs. New comment on
PPC-aware condition. Extend the condition using MINPAGESIZE.
(svr4_exec_displacement): New variable retval. Sanity check it.
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -176,7 +176,7 @@ LM_ADDR_CHECK (struct so_list *so, bfd *abfd)
if (so->lm_info->l_addr == (CORE_ADDR)-1)
{
struct bfd_section *dyninfo_sect;
- CORE_ADDR l_addr, l_dynaddr, dynaddr, align = 0x1000;
+ CORE_ADDR l_addr, l_dynaddr, dynaddr;
l_addr = LM_ADDR_FROM_LINK_MAP (so);
@@ -193,6 +193,9 @@ LM_ADDR_CHECK (struct so_list *so, bfd *abfd)
if (dynaddr + l_addr != l_dynaddr)
{
+ CORE_ADDR align = 0x1000;
+ CORE_ADDR minpagesize = align;
+
if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
{
Elf_Internal_Ehdr *ehdr = elf_tdata (abfd)->elf_header;
@@ -204,6 +207,8 @@ LM_ADDR_CHECK (struct so_list *so, bfd *abfd)
for (i = 0; i < ehdr->e_phnum; i++)
if (phdr[i].p_type == PT_LOAD && phdr[i].p_align > align)
align = phdr[i].p_align;
+
+ minpagesize = get_elf_backend_data (abfd)->minpagesize;
}
/* Turn it into a mask. */
@@ -217,8 +222,20 @@ LM_ADDR_CHECK (struct so_list *so, bfd *abfd)
location, or anything, really. To avoid regressions,
don't adjust the base offset in the latter case, although
odds are that, if things really changed, debugging won't
- quite work. */
- if ((l_addr & align) == ((l_dynaddr - dynaddr) & align))
+ quite work.
+
+ One could rather expect the condition
+ ((l_addr & align) == 0 && ((l_dynaddr - dynaddr) & align) == 0)
+ but the one below is relaxed for PPC. The PPC kernel supports
+ either 4k or 64k page sizes. To be prepared for 64k pages,
+ PPC ELF files are built using an alignment requirement of 64k.
+ However, when running on a kernel supporting 4k pages, the memory
+ mapping of the library may not actually happen on a 64k boundary!
+
+ Check at least the MINPAGESIZE alignment still valid on PPC. */
+
+ if ((l_addr & (minpagesize - 1)) == 0
+ && (l_addr & align) == ((l_dynaddr - dynaddr) & align))
{
l_addr = l_dynaddr - dynaddr;
@@ -1629,7 +1646,42 @@ svr4_exec_displacement (void)
return 0;
if (target_auxv_search (¤t_target, AT_ENTRY, &entry_point) == 1)
- return entry_point - bfd_get_start_address (exec_bfd);
+ {
+ CORE_ADDR retval = entry_point - bfd_get_start_address (exec_bfd);
+
+ /* If current executable is not PIE (Position Independent Executable)
+ suppress any messages. */
+ if (retval == 0)
+ return 0;
+
+ if (bfd_get_flavour (exec_bfd) == bfd_target_elf_flavour)
+ {
+ const struct elf_backend_data *elf = get_elf_backend_data (exec_bfd);
+
+ /* Check of the alignment against max (p_align) of PT_LOAD segments
+ cannot be used here as in LM_ADDR_CHECK for PIC libraries as at
+ least amd64 PIE executables have 2MB p_align while Linux kernel
+ loads them with arbitrary 4KB displacement. As in this case there
+ is no LM_ADDR_FROM_LINK_MAP to verify the possible offset GDB has
+ to depend just on MINPAGESIZE. */
+
+ if ((retval & (elf->minpagesize - 1)) != 0)
+ {
+ warning (_("PIE (Position Independent Executable) displacement "
+ "%s is not aligned to the minimal page size %s "
+ "for \"%s\" (wrong executable or version mismatch?)"),
+ paddress (target_gdbarch, retval),
+ paddress (target_gdbarch, elf->minpagesize),
+ bfd_get_filename (exec_bfd));
+ return 0;
+ }
+ }
+
+ warning (_("Using PIE (Position Independent Executable) displacement %s "
+ "for \"%s\""),
+ paddress (target_gdbarch, retval), bfd_get_filename (exec_bfd));
+ return retval;
+ }
return svr4_static_exec_displacement ();
}
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [patch] Sanity check PIE displacement (like the PIC one)
2010-02-01 1:20 [patch] Sanity check PIE displacement (like the PIC one) Jan Kratochvil
2010-02-11 16:37 ` [ping] " Jan Kratochvil
@ 2010-02-11 19:43 ` Tom Tromey
2010-02-11 20:05 ` Daniel Jacobowitz
2010-02-13 20:14 ` [cancelled] " Jan Kratochvil
2 siblings, 1 reply; 10+ messages in thread
From: Tom Tromey @ 2010-02-11 19:43 UTC (permalink / raw)
To: Jan Kratochvil; +Cc: gdb-patches
>>>>> "Jan" == Jan Kratochvil <jan.kratochvil@redhat.com> writes:
Thanks for pinging this patch.
Jan> The current PIC message being printed "all the time" is:
Jan> warning: .dynamic section for "/lib64/librt-2.11.1.so" is not at the expected address
Jan> warning: difference appears to be caused by prelink, adjusting expectations
[...]
Jan> I do not find the current PIC message too useful (moreover without
Jan> any offset printed). Therefore I am open to removing both the PIC
Jan> (and new PIE) messages when the offset is successfuly considered as
Jan> valid.
I don't find that PIC message particularly useful, either.
Is there some situation where that information is helpful?
If not, then IMO we should remove it.
Jan> 2010-02-01 Jan Kratochvil <jan.kratochvil@redhat.com>
Jan> * solib-svr4.c (LM_ADDR_CHECK): Move variable align to a more inner
Jan> block. New variable minpagesize, set it for ELF ABFDs. New comment on
Jan> PPC-aware condition. Extend the condition using MINPAGESIZE.
Jan> (svr4_exec_displacement): New variable retval. Sanity check it.
Most of it seems reasonable to me.
Jan> + warning (_("Using PIE (Position Independent Executable) displacement %s "
Jan> + "for \"%s\""),
Jan> + paddress (target_gdbarch, retval), bfd_get_filename (exec_bfd));
This is printed unconditionally. But again, when would it matter to the
user?
If it isn't directly informative, I think we should prefer to be silent.
If it is needed in some obscure situation, maybe we can add an equally
obscure command to print it.
What do you think?
Tom
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [patch] Sanity check PIE displacement (like the PIC one)
2010-02-11 19:43 ` Tom Tromey
@ 2010-02-11 20:05 ` Daniel Jacobowitz
2010-02-11 21:47 ` Tom Tromey
2010-02-11 22:21 ` Jan Kratochvil
0 siblings, 2 replies; 10+ messages in thread
From: Daniel Jacobowitz @ 2010-02-11 20:05 UTC (permalink / raw)
To: Tom Tromey; +Cc: Jan Kratochvil, gdb-patches
On Thu, Feb 11, 2010 at 12:43:00PM -0700, Tom Tromey wrote:
> >>>>> "Jan" == Jan Kratochvil <jan.kratochvil@redhat.com> writes:
>
> Thanks for pinging this patch.
>
> Jan> The current PIC message being printed "all the time" is:
> Jan> warning: .dynamic section for "/lib64/librt-2.11.1.so" is not at the expected address
> Jan> warning: difference appears to be caused by prelink, adjusting expectations
> [...]
> Jan> I do not find the current PIC message too useful (moreover without
> Jan> any offset printed). Therefore I am open to removing both the PIC
> Jan> (and new PIE) messages when the offset is successfuly considered as
> Jan> valid.
>
> I don't find that PIC message particularly useful, either.
> Is there some situation where that information is helpful?
> If not, then IMO we should remove it.
Under what circumstances would you remove it? I'd favor removing the
former warning when the second one would be printed, but not otherwise.
The first message is a real life-saver. It triggers when you have the
wrong C library when loading a core file or using a sysroot.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [patch] Sanity check PIE displacement (like the PIC one)
2010-02-11 20:05 ` Daniel Jacobowitz
@ 2010-02-11 21:47 ` Tom Tromey
2010-02-11 22:21 ` Jan Kratochvil
1 sibling, 0 replies; 10+ messages in thread
From: Tom Tromey @ 2010-02-11 21:47 UTC (permalink / raw)
To: Jan Kratochvil; +Cc: gdb-patches
>>>>> "Daniel" == Daniel Jacobowitz <dan@codesourcery.com> writes:
Jan> warning: .dynamic section for "/lib64/librt-2.11.1.so" is not at the expected address
Jan> warning: difference appears to be caused by prelink, adjusting expectations
Tom> I don't find that PIC message particularly useful, either.
Tom> Is there some situation where that information is helpful?
Tom> If not, then IMO we should remove it.
Daniel> Under what circumstances would you remove it? I'd favor
Daniel> removing the former warning when the second one would be
Daniel> printed, but not otherwise.
Ok.
Daniel> The first message is a real life-saver. It triggers when you
Daniel> have the wrong C library when loading a core file or using a
Daniel> sysroot.
Thanks, I had not considered this scenario.
Tom
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [patch] Sanity check PIE displacement (like the PIC one)
2010-02-11 20:05 ` Daniel Jacobowitz
2010-02-11 21:47 ` Tom Tromey
@ 2010-02-11 22:21 ` Jan Kratochvil
2010-02-11 22:26 ` Daniel Jacobowitz
1 sibling, 1 reply; 10+ messages in thread
From: Jan Kratochvil @ 2010-02-11 22:21 UTC (permalink / raw)
To: Tom Tromey, gdb-patches
On Thu, 11 Feb 2010 21:05:11 +0100, Daniel Jacobowitz wrote:
> On Thu, Feb 11, 2010 at 12:43:00PM -0700, Tom Tromey wrote:
> > Jan> The current PIC message being printed "all the time" is:
> > Jan> warning: .dynamic section for "/lib64/librt-2.11.1.so" is not at the expected address
> > Jan> warning: difference appears to be caused by prelink, adjusting expectations
> > [...]
> > Jan> I do not find the current PIC message too useful (moreover without
> > Jan> any offset printed). Therefore I am open to removing both the PIC
> > Jan> (and new PIE) messages when the offset is successfuly considered as
> > Jan> valid.
> >
> > I don't find that PIC message particularly useful, either.
> > Is there some situation where that information is helpful?
> > If not, then IMO we should remove it.
>
> Under what circumstances would you remove it? I'd favor removing the
> former warning when the second one would be printed, but not otherwise.
>
> The first message is a real life-saver. It triggers when you have the
> wrong C library when loading a core file or using a sysroot.
solib-svr4.c LM_ADDR_CHECK
if ((l_addr & align) == ((l_dynaddr - dynaddr) & align))
{
A1: warning (_(".dynamic section for \"%s\" "
"is not at the expected address"), so->so_name);
A2: warning (_("difference appears to be caused by prelink, "
"adjusting expectations"));
}
else
B: warning (_(".dynamic section for \"%s\" "
"is not at the expected address "
"(wrong library or version mismatch?)"), so->so_name);
I got lost in what specific messages got referenced by these mails.
The life-saver message is IMO "B" but the message(s) being discussed to be
removed is A1+A2.
Is the attached patch what everone agrees upon or have I not understood it?
No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu.
Thanks,
Jan
gdb/
2010-02-11 Jan Kratochvil <jan.kratochvil@redhat.com>
* solib-svr4.c: Include gdbcmd.h.
(solib_svr4_debug): New.
(LM_ADDR_CHECK): Print successful prelink adjustment only if
SOLIB_SVR4_DEBUG.
(_initialize_svr4_solib): Register solib_svr4_debug.
gdb/testsuite/
2010-02-11 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.base/prelink.exp (set debug solib-svr4 1): New.
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -35,6 +35,7 @@
#include "regcache.h"
#include "gdbthread.h"
#include "observer.h"
+#include "gdbcmd.h"
#include "gdb_assert.h"
@@ -48,6 +49,9 @@
#include "auxv.h"
#include "exceptions.h"
+/* Flag which indicates whether internal debug messages should be printed. */
+static int solib_svr4_debug;
+
static struct link_map_offsets *svr4_fetch_link_map_offsets (void);
static int svr4_have_link_map_offsets (void);
static void svr4_relocate_main_executable (void);
@@ -222,10 +226,13 @@ LM_ADDR_CHECK (struct so_list *so, bfd *abfd)
{
l_addr = l_dynaddr - dynaddr;
- warning (_(".dynamic section for \"%s\" "
- "is not at the expected address"), so->so_name);
- warning (_("difference appears to be caused by prelink, "
- "adjusting expectations"));
+ if (solib_svr4_debug)
+ {
+ warning (_(".dynamic section for \"%s\" "
+ "is not at the expected address"), so->so_name);
+ warning (_("difference appears to be caused by prelink, "
+ "adjusting expectations"));
+ }
}
else
warning (_(".dynamic section for \"%s\" "
@@ -2033,4 +2040,14 @@ _initialize_svr4_solib (void)
svr4_so_ops.lookup_lib_global_symbol = elf_lookup_lib_symbol;
svr4_so_ops.same = svr4_same;
svr4_so_ops.keep_data_in_core = svr4_keep_data_in_core;
+
+ /* Debug this file's internals. */
+ add_setshow_zinteger_cmd ("solib-svr4", class_maintenance,
+ &solib_svr4_debug, _("\
+Set internal debugging of shared library code for SVR4."), _("\
+Show internal debugging of shared library code for SVR4."), _("\
+When non-zero, SVR4 solib specific internal debugging is enabled."),
+ NULL,
+ NULL,
+ &setdebuglist, &showdebuglist);
}
--- a/gdb/testsuite/gdb.base/prelink.exp
+++ b/gdb/testsuite/gdb.base/prelink.exp
@@ -109,6 +109,9 @@ gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
+# Print the "adjusting expectations" message.
+gdb_test "set debug solib-svr4 1"
+
set test "prelink"
global gdb_prompt
gdb_test_multiple "core-file $objdir/$subdir/prelink.core" "$test" {
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [patch] Sanity check PIE displacement (like the PIC one)
2010-02-11 22:21 ` Jan Kratochvil
@ 2010-02-11 22:26 ` Daniel Jacobowitz
2010-02-11 23:16 ` Jan Kratochvil
2010-02-13 12:05 ` Jan Kratochvil
0 siblings, 2 replies; 10+ messages in thread
From: Daniel Jacobowitz @ 2010-02-11 22:26 UTC (permalink / raw)
To: Jan Kratochvil; +Cc: Tom Tromey, gdb-patches
On Thu, Feb 11, 2010 at 11:21:13PM +0100, Jan Kratochvil wrote:
> The life-saver message is IMO "B" but the message(s) being discussed to be
> removed is A1+A2.
>
> Is the attached patch what everone agrees upon or have I not understood it?
Fine with me. Or you could just use verbose.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [patch] Sanity check PIE displacement (like the PIC one)
2010-02-11 22:26 ` Daniel Jacobowitz
@ 2010-02-11 23:16 ` Jan Kratochvil
2010-02-13 12:05 ` Jan Kratochvil
1 sibling, 0 replies; 10+ messages in thread
From: Jan Kratochvil @ 2010-02-11 23:16 UTC (permalink / raw)
To: Tom Tromey, gdb-patches
On Thu, 11 Feb 2010 23:26:07 +0100, Daniel Jacobowitz wrote:
> On Thu, Feb 11, 2010 at 11:21:13PM +0100, Jan Kratochvil wrote:
> > The life-saver message is IMO "B" but the message(s) being discussed to be
> > removed is A1+A2.
> >
> > Is the attached patch what everone agrees upon or have I not understood it?
>
> Fine with me. Or you could just use verbose.
OK, verbose may be more appropriate.
Made some additional text content changes, therefore asking for new approval.
.dynamic section for ".../gdb.base/prelink.so" at 0x38b38006c0 is not at the expected address 0x39bb6006c0, difference appears to be caused by prelink, adjusting expectations.
No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu.
Thanks,
Jan
gdb/
2010-02-11 Jan Kratochvil <jan.kratochvil@redhat.com>
* solib-svr4.c: (LM_ADDR_CHECK): Print successful prelink adjustment
only if INFO_VERBOSE. Use printf_unfiltered for it. Add trailing dot.
Print twice paddress for both successful and unsuccessful adjustment.
Gdb/testsuite/
2010-02-11 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.base/prelink.exp (set verbose on): New.
(prelink): Remove expected "warning: " prefixes.
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -222,15 +222,21 @@ LM_ADDR_CHECK (struct so_list *so, bfd *abfd)
{
l_addr = l_dynaddr - dynaddr;
- warning (_(".dynamic section for \"%s\" "
- "is not at the expected address"), so->so_name);
- warning (_("difference appears to be caused by prelink, "
- "adjusting expectations"));
+ if (info_verbose)
+ printf_unfiltered (_(".dynamic section for \"%s\" at %s "
+ "is not at the expected address %s, "
+ "difference appears to be caused "
+ "by prelink, adjusting expectations.\n"),
+ so->so_name,
+ paddress (target_gdbarch, dynaddr),
+ paddress (target_gdbarch, l_dynaddr));
}
else
- warning (_(".dynamic section for \"%s\" "
- "is not at the expected address "
- "(wrong library or version mismatch?)"), so->so_name);
+ warning (_(".dynamic section for \"%s\" at %s "
+ "is not at the expected address %s "
+ "(wrong library or version mismatch?)"), so->so_name,
+ paddress (target_gdbarch, dynaddr),
+ paddress (target_gdbarch, l_dynaddr));
}
set_addr:
--- a/gdb/testsuite/gdb.base/prelink.exp
+++ b/gdb/testsuite/gdb.base/prelink.exp
@@ -109,10 +109,13 @@ gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
+# Print the "adjusting expectations" message.
+gdb_test "set verbose on"
+
set test "prelink"
global gdb_prompt
gdb_test_multiple "core-file $objdir/$subdir/prelink.core" "$test" {
- -re "warning: \.dynamic section.*not at the expected address.*warning: difference.*caused by prelink, adjusting expectations.*$gdb_prompt $" {
+ -re "\.dynamic section.*not at the expected address.*difference.*caused by prelink, adjusting expectations.*$gdb_prompt $" {
pass "$test"
}
}
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [patch] Sanity check PIE displacement (like the PIC one)
2010-02-11 22:26 ` Daniel Jacobowitz
2010-02-11 23:16 ` Jan Kratochvil
@ 2010-02-13 12:05 ` Jan Kratochvil
1 sibling, 0 replies; 10+ messages in thread
From: Jan Kratochvil @ 2010-02-13 12:05 UTC (permalink / raw)
To: gdb-patches; +Cc: Tom Tromey
On Thu, 11 Feb 2010 23:26:07 +0100, Daniel Jacobowitz wrote:
> On Thu, Feb 11, 2010 at 11:21:13PM +0100, Jan Kratochvil wrote:
> > The life-saver message is IMO "B" but the message(s) being discussed to be
> > removed is A1+A2.
> >
> > Is the attached patch what everone agrees upon or have I not understood it?
>
> Fine with me. Or you could just use verbose.
Checked it in pre-approved for "verbose" without changing the content to move
forward with the PIE part.
Thanks,
Jan
http://sourceware.org/ml/gdb-cvs/2010-02/msg00100.html
--- src/gdb/ChangeLog 2010/02/12 21:28:25 1.11356
+++ src/gdb/ChangeLog 2010/02/13 12:02:26 1.11357
@@ -1,3 +1,8 @@
+2010-02-13 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ * solib-svr4.c: (LM_ADDR_CHECK): Print successful prelink adjustment
+ only if INFO_VERBOSE.
+
2010-02-12 Tomas Holmberg <th@virtutech.com>
* mi/mi-main.c: Added the --reverse flag to the following MI
--- src/gdb/solib-svr4.c 2010/02/11 23:07:23 1.119
+++ src/gdb/solib-svr4.c 2010/02/13 12:02:28 1.120
@@ -234,10 +234,13 @@
{
l_addr = l_dynaddr - dynaddr;
- warning (_(".dynamic section for \"%s\" "
- "is not at the expected address"), so->so_name);
- warning (_("difference appears to be caused by prelink, "
- "adjusting expectations"));
+ if (info_verbose)
+ {
+ warning (_(".dynamic section for \"%s\" "
+ "is not at the expected address"), so->so_name);
+ warning (_("difference appears to be caused by prelink, "
+ "adjusting expectations"));
+ }
}
else
warning (_(".dynamic section for \"%s\" "
--- src/gdb/testsuite/ChangeLog 2010/02/12 21:39:27 1.2129
+++ src/gdb/testsuite/ChangeLog 2010/02/13 12:02:29 1.2130
@@ -1,3 +1,7 @@
+2010-02-13 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ * gdb.base/prelink.exp (set verbose on): New.
+
2010-02-12 Tomas Holmberg <th@virtutech.com>
* mi-reverse.exp: New file. Test for reverse option to the
--- src/gdb/testsuite/gdb.base/prelink.exp 2010/01/01 07:32:01 1.10
+++ src/gdb/testsuite/gdb.base/prelink.exp 2010/02/13 12:02:29 1.11
@@ -109,6 +109,9 @@
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
+# Print the "adjusting expectations" message.
+gdb_test "set verbose on"
+
set test "prelink"
global gdb_prompt
gdb_test_multiple "core-file $objdir/$subdir/prelink.core" "$test" {
^ permalink raw reply [flat|nested] 10+ messages in thread
* [cancelled] Re: [patch] Sanity check PIE displacement (like the PIC one)
2010-02-01 1:20 [patch] Sanity check PIE displacement (like the PIC one) Jan Kratochvil
2010-02-11 16:37 ` [ping] " Jan Kratochvil
2010-02-11 19:43 ` Tom Tromey
@ 2010-02-13 20:14 ` Jan Kratochvil
2 siblings, 0 replies; 10+ messages in thread
From: Jan Kratochvil @ 2010-02-13 20:14 UTC (permalink / raw)
To: gdb-patches
Obsoleted by:
[patch] Sanity check PIE displacement #2
http://sourceware.org/ml/gdb-patches/2010-02/msg00340.html
[patch] Extend PIC displacement check by minpagesize
http://sourceware.org/ml/gdb-patches/2010-02/msg00337.html
[commit] solib-svr4.c: cleanup: Move variable
http://sourceware.org/ml/gdb-patches/2010-02/msg00335.html
Re: [patch] Sanity check PIE displacement (like the PIC one)
http://sourceware.org/ml/gdb-patches/2010-02/msg00334.html
[PIC -> if (info_verbose)]
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2010-02-13 20:14 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-01 1:20 [patch] Sanity check PIE displacement (like the PIC one) Jan Kratochvil
2010-02-11 16:37 ` [ping] " Jan Kratochvil
2010-02-11 19:43 ` Tom Tromey
2010-02-11 20:05 ` Daniel Jacobowitz
2010-02-11 21:47 ` Tom Tromey
2010-02-11 22:21 ` Jan Kratochvil
2010-02-11 22:26 ` Daniel Jacobowitz
2010-02-11 23:16 ` Jan Kratochvil
2010-02-13 12:05 ` Jan Kratochvil
2010-02-13 20:14 ` [cancelled] " Jan Kratochvil
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox