* [patch 1/5] [ppc] testsuite: break-interp.exp: Fix false "ZERO displacement"
@ 2010-09-27 20:23 Jan Kratochvil
2010-10-11 8:45 ` Jan Kratochvil
0 siblings, 1 reply; 2+ messages in thread
From: Jan Kratochvil @ 2010-09-27 20:23 UTC (permalink / raw)
To: gdb-patches; +Cc: Luis Machado
Hi,
there were false "ZERO displacement" FAILs on ppc* (and also s390*) arches.
It is due to the different Linux kernel behavior there.
* The purpose of prelink is to give performance by reducing randomness.
* PIE giving security is more important than prelink giving performance.
* Therefore normally prelink is never applied on PIE executables.
* But if we artificially apply prelink to a PIE executable:
Then x86* kernel prefers to respect prelink while ppc* kernel prefers to
respect PIE.
So the testcase now no longer makes the x86*-biased last assumption.
Thanks,
Jan
gdb/testsuite/
2010-09-27 Jan Kratochvil <jan.kratochvil@redhat.com>
Fix results of prelinked PIEs on ppc*.
* gdb.base/break-interp.exp (reach, test_core, test_attach_gdb):
Accept also DISPLACEMENT "PRESENT".
(main): Replace "ZERO" displacements by "PRESENT".
--- a/gdb/testsuite/gdb.base/break-interp.exp
+++ b/gdb/testsuite/gdb.base/break-interp.exp
@@ -109,7 +109,9 @@ proc strip_debug {dest} {
}
# `runto' does not check we stopped really at the function we specified.
-# DISPLACEMENT can be "NONE", "ZERO" or "NONZERO"
+# DISPLACEMENT can be "NONE" for no message to be present, "ZERO" for
+# displacement of 0 bytes to be present, "NONZERO" for displacement of non-0
+# bytes to be present and "PRESENT" if both "ZERO" and "NONZERO" are valid.
proc reach {func command displacement} {
global gdb_prompt expect_out
@@ -128,7 +130,7 @@ proc reach {func command displacement} {
} else {
set case "NONZERO"
}
- if {$displacement == $case} {
+ if {$displacement == $case || $displacement == "PRESENT"} {
pass $test_displacement
set displacement "FOUND-$displacement"
} else {
@@ -184,7 +186,7 @@ proc test_core {file displacement} {
} else {
set case "NONZERO"
}
- if {$displacement == $case} {
+ if {$displacement == $case || $displacement == "PRESENT"} {
pass $test_displacement
set displacement "FOUND-$displacement"
} else {
@@ -241,7 +243,7 @@ proc test_attach_gdb {file pid displacement prefix} {
} else {
set case "NONZERO"
}
- if {$displacement == $case} {
+ if {$displacement == $case || $displacement == "PRESENT"} {
pass $test_displacement
set displacement "FOUND-$displacement"
} else {
@@ -428,7 +430,7 @@ proc test_ld {file ifmain trynosym displacement} {
} else {
set case "NONZERO"
}
- if {$displacement == $case} {
+ if {$displacement == $case || $displacement == "PRESENT"} {
pass $test_displacement
set displacement "FOUND-$displacement"
} else {
@@ -533,7 +535,10 @@ foreach ldprelink {NO YES} {
if {$ldprelink == "NO"} {
set displacement "NONZERO"
} else {
- set displacement "ZERO"
+ # x86* kernel loads prelinked PIE binary at its prelinked address
+ # but ppc* kernel loads it at a random address. prelink normally
+ # skips PIE binaries during the system scan.
+ set displacement "PRESENT"
}
test_ld $interp 0 [expr {$ldsepdebug == "NO"}] $displacement
@@ -582,7 +587,11 @@ foreach ldprelink {NO YES} {
} elseif {$binprelink == "NO"} {
set displacement "NONZERO"
} else {
- set displacement "ZERO"
+ # x86* kernel loads prelinked PIE binary at its
+ # prelinked address but ppc* kernel loads it at
+ # a random address. prelink normally skips PIE
+ # binaries during the system scan.
+ set displacement "PRESENT"
}
if {[prelink$binprelink $relink_args [file tail $exec]]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [patch 1/5] [ppc] testsuite: break-interp.exp: Fix false "ZERO displacement"
2010-09-27 20:23 [patch 1/5] [ppc] testsuite: break-interp.exp: Fix false "ZERO displacement" Jan Kratochvil
@ 2010-10-11 8:45 ` Jan Kratochvil
0 siblings, 0 replies; 2+ messages in thread
From: Jan Kratochvil @ 2010-10-11 8:45 UTC (permalink / raw)
To: gdb-patches; +Cc: Luis Machado
On Mon, 27 Sep 2010 20:59:07 +0200, Jan Kratochvil wrote:
> there were false "ZERO displacement" FAILs on ppc* (and also s390*) arches.
[...]
> gdb/testsuite/
> 2010-09-27 Jan Kratochvil <jan.kratochvil@redhat.com>
>
> Fix results of prelinked PIEs on ppc*.
> * gdb.base/break-interp.exp (reach, test_core, test_attach_gdb):
> Accept also DISPLACEMENT "PRESENT".
> (main): Replace "ZERO" displacements by "PRESENT".
Checked-in:
http://sourceware.org/ml/gdb-cvs/2010-10/msg00065.html
Regards,
Jan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-10-11 8:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-27 20:23 [patch 1/5] [ppc] testsuite: break-interp.exp: Fix false "ZERO displacement" Jan Kratochvil
2010-10-11 8:45 ` Jan Kratochvil
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).