From patchwork Mon Mar 18 15:39:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 31895 Received: (qmail 84958 invoked by alias); 18 Mar 2019 15:39:54 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 84949 invoked by uid 89); 18 Mar 2019 15:39:53 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-20.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=minsyms.c, minsymsc, UD:minsyms.c, minimal_symbol X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 18 Mar 2019 15:39:52 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 22E29561B5; Mon, 18 Mar 2019 11:39:50 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 5xu8eGXwzGTC; Mon, 18 Mar 2019 11:39:50 -0400 (EDT) Received: from murgatroyd.Home (174-29-37-56.hlrn.qwest.net [174.29.37.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by rock.gnat.com (Postfix) with ESMTPSA id CCE4C561B4; Mon, 18 Mar 2019 11:39:49 -0400 (EDT) From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [FYI] Fix regression caused by minimal symbol changes Date: Mon, 18 Mar 2019 09:39:48 -0600 Message-Id: <20190318153948.16294-1-tromey@adacore.com> MIME-Version: 1.0 The earlier patch to change minimal symbol allocations to use xmalloc erroneously left a call to obstack_blank in minimal_symbol_reader::install. Because obstack_blank does not finish the object allocation on an obstack, this in turn could cause invalid memory reads in some situations. This patch fixes the problem by removing the call. Tested on x86-64 Fedora 29; also verified with valgrind. gdb/ChangeLog 2019-03-18 Tom Tromey * minsyms.c (minimal_symbol_reader::install): Remove call to obstack_blank. --- gdb/ChangeLog | 5 +++++ gdb/minsyms.c | 2 -- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/gdb/minsyms.c b/gdb/minsyms.c index fe2ad949d0b..b95e9ef6e8b 100644 --- a/gdb/minsyms.c +++ b/gdb/minsyms.c @@ -1360,8 +1360,6 @@ minimal_symbol_reader::install () we will give back the excess space. */ alloc_count = m_msym_count + m_objfile->per_bfd->minimal_symbol_count; - obstack_blank (&m_objfile->per_bfd->storage_obstack, - alloc_count * sizeof (struct minimal_symbol)); gdb::unique_xmalloc_ptr msym_holder (XNEWVEC (minimal_symbol, alloc_count)); msymbols = msym_holder.get ();