From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mout01.posteo.de (mout01.posteo.de [185.67.36.65]) by sourceware.org (Postfix) with ESMTPS id 4FF3A3858C2C for ; Sat, 4 Sep 2021 08:38:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4FF3A3858C2C Received: from submission (posteo.de [89.146.220.130]) by mout01.posteo.de (Postfix) with ESMTPS id C547D240026 for ; Sat, 4 Sep 2021 10:38:39 +0200 (CEST) Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4H1p3M0LvTz9rxf for ; Sat, 4 Sep 2021 10:38:38 +0200 (CEST) From: Alexander Egorenkov To: elfutils-devel@sourceware.org Cc: Subject: Adding a new section to an ELF file aborts with Assertion `shdr != NULL' Date: Sat, 04 Sep 2021 08:38:51 +0000 Message-ID: <87tuj020ro.fsf@posteo.net> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, 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: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Sep 2021 08:38:42 -0000 Hi all, i'm facing an issue with libelf when i try to add a new section to an ELF file. How to reproduce the issue: 1. Create a simple ELF file with libelf containing only 2 sections, NULL and a string table 2. Close ELF file 3. Reopen the new ELF file in RW mode with libelf 4. Add new section with elf_newscn() 5. Update ELF with elf_update() 6. Assertion appears The weird thing is that if i add only a new program segment then everything goes well. But as soon as i add a new section, it fails. Error message: test: elf32_updatenull.c:214: __elf64_updatenull_wrlock: Assertion `shdr != NULL' failed. Any hint what i'm doing wrong ? Thank you Regards Alex