From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31187 invoked by alias); 31 Aug 2019 19:04:31 -0000 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 Received: (qmail 31179 invoked by uid 89); 31 Aug 2019 19:04:31 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.7 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy=HX-Envelope-From:sk:andrew., Reading, showing X-HELO: mail-wm1-f45.google.com Received: from mail-wm1-f45.google.com (HELO mail-wm1-f45.google.com) (209.85.128.45) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 31 Aug 2019 19:04:29 +0000 Received: by mail-wm1-f45.google.com with SMTP id t17so10615713wmi.2 for ; Sat, 31 Aug 2019 12:04:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=tx5OoW1p2awrC2qDpBpaI5LpLbXcdB+cUx6qHk1y72Y=; b=HHL1v2WNHOXFdV87mywD0UWeASvWV5GAYwp/AKGOEPwnxkxXuFGYujSnCw30N5IERC QfsaOoc/tMQ1qUN9HwOhOyDbgEzPqJRIssrphd6IkHP1Zy91rvyEaytsI+HdpGJEH29q MwacQH6T2nfn/4uctOSo/HUQShIldbmmM350kYGQkrLNpLYYw8FKJE+sf/Ms0jfUK1wo 9dHxe7L620qk7zBT1FvzeMKI9bq1tB+OJTID+kFF2uf3UdluCtgrzq76M8f6abDsnWut W3kK1taLEBxB8S8lS+XkPM13XwbAMQdX6IUUks0v6zbM3Fuhv0NZnY5zTP0jAbriJOow u/0g== Return-Path: Received: from localhost (host86-161-16-231.range86-161.btcentralplus.com. [86.161.16.231]) by smtp.gmail.com with ESMTPSA id q19sm18694728wra.89.2019.08.31.12.04.26 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 31 Aug 2019 12:04:26 -0700 (PDT) Date: Sat, 31 Aug 2019 19:04:00 -0000 From: Andrew Burgess To: Philippe Waroquiers Cc: gdb-patches@sourceware.org Subject: Re: [RFA] Avoid expect's buffer overflow in info-var.exp test. Message-ID: <20190831190424.GZ6076@embecosm.com> References: <20190831153656.6439-1-philippe.waroquiers@skynet.be> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190831153656.6439-1-philippe.waroquiers@skynet.be> X-Fortune: There are more old drunkards than old doctors. X-Editor: GNU Emacs [ http://www.gnu.org/software/emacs ] User-Agent: Mutt/1.9.2 (2017-12-15) X-IsSubscribed: yes X-SW-Source: 2019-08/txt/msg00669.txt.bz2 * Philippe Waroquiers [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 > > * 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 >