From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) by sourceware.org (Postfix) with ESMTPS id AE3B13858417 for ; Tue, 9 Nov 2021 10:41:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org AE3B13858417 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=seketeli.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=seketeli.org Received: (Authenticated sender: dodji@seketeli.org) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id DDECF2000A; Tue, 9 Nov 2021 10:41:01 +0000 (UTC) Received: by localhost (Postfix, from userid 1000) id A6D1358010A; Tue, 9 Nov 2021 11:40:52 +0100 (CET) From: Dodji Seketeli To: "Jose E. Marchesi via Libabigail" Subject: Re: [PATCH V2] ctf: make libabigail::ctf_reader::read_corpus reentrant Organization: Me, myself and I References: <20211103135820.6233-1-jose.marchesi@oracle.com> X-Operating-System: Fedora 36 X-URL: http://www.seketeli.net/~dodji Date: Tue, 09 Nov 2021 11:40:52 +0100 In-Reply-To: <20211103135820.6233-1-jose.marchesi@oracle.com> (Jose E. Marchesi via Libabigail's message of "Wed, 3 Nov 2021 14:58:20 +0100") Message-ID: <877ddh8vd7.fsf@seketeli.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-9.5 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Nov 2021 10:41:05 -0000 "Jose E. Marchesi via Libabigail" a =C3=A9crit: > [Changes from V1: > - Make sure that the string table passed to libctf is the one related > to the symbol table.] Pffft. I mistakenly applied the V1 patch to master, sorry about that. So I am providing below a "differential" patch that would bring master to the level of this V2 patch. Would you mind reviewing it, please, (and sign it off) so that I can apply it master as well? Thanks, and sorry again. Cheers, >From b3e9ff53879939a3e0d4092ecd23cbd39393c268 Mon Sep 17 00:00:00 2001 From: Dodji Seketeli Date: Tue, 9 Nov 2021 11:24:16 +0100 Subject: [PATCH] ctf-reader: Use the string table related to the symtab There can be several string tables in the ELF file. The one we want to use is the one related to the symbol table, referred to by its sh_link property. This patch ensures that. * src/abg-ctf-reader.cc (slurp_elf_info): Use the string table related to the symbol table. Signed-off-by: Dodji Seketeli --- src/abg-ctf-reader.cc | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/abg-ctf-reader.cc b/src/abg-ctf-reader.cc index 51fb2ed9..33642821 100644 --- a/src/abg-ctf-reader.cc +++ b/src/abg-ctf-reader.cc @@ -1037,12 +1037,20 @@ slurp_elf_info(read_context *ctxt, corpus_sptr corp) 0 /* No suppressions. */); corp->set_symtab(ctxt->symtab); =20 - /* Get the raw ELF section contents for libctf. */ + /* Get the raw ELF section contents for libctf. The .ctf section + and the symtab are straightforward enough. */ Elf_Scn *ctf_scn =3D elf_helpers::find_section(ctxt->elf_handler, ".ctf"= , SHT_PROGBITS); Elf_Scn *symtab_scn =3D elf_helpers::find_symbol_table_section(ctxt->elf= _handler); - Elf_Scn *strtab_scn =3D elf_helpers::find_section(ctxt->elf_handler, SHT= _STRTAB); =20 - if (ctf_scn =3D=3D NULL || symtab_scn =3D=3D NULL || strtab_scn =3D=3D N= ULL) + if (ctf_scn =3D=3D NULL || symtab_scn =3D=3D NULL) + return 0; + + /* The string table that libctf expects is the one related to the + symbol table by virtue of sh_link. */ + GElf_Shdr symtab_shdr_mem, *symtab_shdr =3D gelf_getshdr(symtab_scn, &sy= mtab_shdr_mem); + Elf_Scn *strtab_scn =3D elf_getscn(ctxt->elf_handler, symtab_shdr->sh_li= nk); + + if (strtab_scn =3D=3D NULL) return 0; =20 fill_ctf_section(ctxt, ctf_scn, &ctxt->ctf_sect); --=20 2.32.0 --=20 Dodji