Message ID | 20190831153656.6439-1-philippe.waroquiers@skynet.be |
---|---|
State | New, archived |
Headers |
Received: (qmail 73062 invoked by alias); 31 Aug 2019 15:37:09 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: <gdb-patches.sourceware.org> List-Unsubscribe: <mailto:gdb-patches-unsubscribe-##L=##H@sourceware.org> List-Subscribe: <mailto:gdb-patches-subscribe@sourceware.org> List-Archive: <http://sourceware.org/ml/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-help@sourceware.org>, <http://sourceware.org/ml/#faqs> Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 73053 invoked by uid 89); 31 Aug 2019 15:37:09 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-15.3 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.1 spammy=showing, HContent-Transfer-Encoding:8bit X-HELO: mailsec112.isp.belgacom.be Received: from mailsec112.isp.belgacom.be (HELO mailsec112.isp.belgacom.be) (195.238.20.108) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 31 Aug 2019 15:37:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=skynet.be; i=@skynet.be; q=dns/txt; s=securemail; t=1567265826; x=1598801826; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=MjosC50KyPUNHI183l7WY6V74n+NiqhVH9FvbI1xJSc=; b=0hSOdPOXAT2rM93C69lMi/RWDsXVkT53bhvB5vMPnqoIBvnDa14As77e Qq7gznEYPptebtSk7LdAI7tFOoyYPA==; Received: from 109.38-176-91.adsl-dyn.isp.belgacom.be (HELO md.home) ([91.176.38.109]) by relay.skynet.be with ESMTP/TLS/DHE-RSA-AES128-GCM-SHA256; 31 Aug 2019 17:37:04 +0200 From: Philippe Waroquiers <philippe.waroquiers@skynet.be> To: gdb-patches@sourceware.org Cc: Philippe Waroquiers <philippe.waroquiers@skynet.be> Subject: [RFA] Avoid expect's buffer overflow in info-var.exp test. Date: Sat, 31 Aug 2019 17:36:56 +0200 Message-Id: <20190831153656.6439-1-philippe.waroquiers@skynet.be> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes |
Commit Message
Philippe Waroquiers
Aug. 31, 2019, 3:36 p.m. UTC
Once the executable is started, info variables can show thousands of variables belonging to glibc (see below). This long list of variables then causes the test to fail, due to expect's buffer overflow: Running /bd/home/philippe/gdb/git/build_binutils-gdb/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.base/info-var.exp ... ERROR: internal buffer is full. ERROR: internal buffer is full. ERROR: internal buffer is full. Fix this by running testing 'info variables' without running the executable. gdb ./info-var ... Reading symbols from ./info-var... (gdb) |info variables|wc 27 54 971 (gdb) start Temporary breakpoint 1 at 0x1129: file /bd/home/philippe/gdb/git/build_binutils-gdb/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.base/info-var-f1.c, line 23. Starting program: /bd/home/philippe/gdb/git/build_binutils-gdb/gdb/testsuite/outputs/gdb.base/info-var/info-var Temporary breakpoint 1, main () at /bd/home/philippe/gdb/git/build_binutils-gdb/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.base/info-var-f1.c:23 23 return global_var + get_offset() + f1_var; (gdb) |info variables|wc 4334 14581 130738 (gdb) gdb/testsuite/ChangeLog YYYY-MM-DD Philippe Waroquiers <philippe.waroquiers@skynet.be> * gdb.base/info-var.exp: Test info variables without running to main, to avoid expect's buffer overflow. --- gdb/testsuite/gdb.base/info-var.exp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
Comments
* Philippe Waroquiers <philippe.waroquiers@skynet.be> [2019-08-31 17:36:56 +0200]: > Once the executable is started, info variables can show thousands > of variables belonging to glibc (see below). > > This long list of variables then causes the test to fail, due > to expect's buffer overflow: > Running /bd/home/philippe/gdb/git/build_binutils-gdb/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.base/info-var.exp ... > ERROR: internal buffer is full. > ERROR: internal buffer is full. > ERROR: internal buffer is full. > > Fix this by running testing 'info variables' without running the > executable. > > gdb ./info-var > ... > Reading symbols from ./info-var... > (gdb) |info variables|wc > 27 54 971 > (gdb) start > Temporary breakpoint 1 at 0x1129: file /bd/home/philippe/gdb/git/build_binutils-gdb/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.base/info-var-f1.c, line 23. > Starting program: /bd/home/philippe/gdb/git/build_binutils-gdb/gdb/testsuite/outputs/gdb.base/info-var/info-var > > Temporary breakpoint 1, main () > at /bd/home/philippe/gdb/git/build_binutils-gdb/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.base/info-var-f1.c:23 > 23 return global_var + get_offset() + f1_var; > (gdb) |info variables|wc > 4334 14581 130738 > (gdb) > > gdb/testsuite/ChangeLog > YYYY-MM-DD Philippe Waroquiers <philippe.waroquiers@skynet.be> > > * gdb.base/info-var.exp: Test info variables without running > to main, to avoid expect's buffer overflow. Seems reasonable to me. Thanks, Andrew > --- > gdb/testsuite/gdb.base/info-var.exp | 7 +++---- > 1 file changed, 3 insertions(+), 4 deletions(-) > > diff --git a/gdb/testsuite/gdb.base/info-var.exp b/gdb/testsuite/gdb.base/info-var.exp > index 6dd896d8aa..c9b7485ffb 100644 > --- a/gdb/testsuite/gdb.base/info-var.exp > +++ b/gdb/testsuite/gdb.base/info-var.exp > @@ -22,10 +22,9 @@ if {[prepare_for_testing "failed to prepare" \ > return -1 > } > > -if ![runto_main] then { > - fail "can't run to main" > - return 0 > -} > +# Note: we do not run to main, as otherwise, the output of info variables > +# can be very long, showing thousands of glibc variables. > +# This long output then causes expect's buffer to overflow. > > gdb_test "info variables" \ > [multi_line \ > -- > 2.20.1 >
On Sat, 2019-08-31 at 20:04 +0100, Andrew Burgess wrote: > > gdb/testsuite/ChangeLog > > YYYY-MM-DD Philippe Waroquiers <philippe.waroquiers@skynet.be> > > > > * gdb.base/info-var.exp: Test info variables without running > > to main, to avoid expect's buffer overflow. > > Seems reasonable to me. Thanks for the review, pushed. Philippe
diff --git a/gdb/testsuite/gdb.base/info-var.exp b/gdb/testsuite/gdb.base/info-var.exp index 6dd896d8aa..c9b7485ffb 100644 --- a/gdb/testsuite/gdb.base/info-var.exp +++ b/gdb/testsuite/gdb.base/info-var.exp @@ -22,10 +22,9 @@ if {[prepare_for_testing "failed to prepare" \ return -1 } -if ![runto_main] then { - fail "can't run to main" - return 0 -} +# Note: we do not run to main, as otherwise, the output of info variables +# can be very long, showing thousands of glibc variables. +# This long output then causes expect's buffer to overflow. gdb_test "info variables" \ [multi_line \