From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16960 invoked by alias); 27 Sep 2010 18:59:28 -0000 Received: (qmail 16952 invoked by uid 22791); 27 Sep 2010 18:59:27 -0000 X-SWARE-Spam-Status: No, hits=-6.1 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 27 Sep 2010 18:59:22 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o8RIxAcv025186 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 27 Sep 2010 14:59:10 -0400 Received: from host1.dyn.jankratochvil.net (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o8RIx8Cv011536 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 27 Sep 2010 14:59:09 -0400 Received: from host1.dyn.jankratochvil.net (localhost [127.0.0.1]) by host1.dyn.jankratochvil.net (8.14.4/8.14.4) with ESMTP id o8RIx7S5019531; Mon, 27 Sep 2010 20:59:07 +0200 Received: (from jkratoch@localhost) by host1.dyn.jankratochvil.net (8.14.4/8.14.4/Submit) id o8RIx7ug019530; Mon, 27 Sep 2010 20:59:07 +0200 Date: Mon, 27 Sep 2010 20:23:00 -0000 From: Jan Kratochvil To: gdb-patches@sourceware.org Cc: Luis Machado Subject: [patch 1/5] [ppc] testsuite: break-interp.exp: Fix false "ZERO displacement" Message-ID: <20100927185907.GA18650@host1.dyn.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-09/txt/msg00458.txt.bz2 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 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]]