From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gnu.wildebeest.org (gnu.wildebeest.org [45.83.234.184]) by sourceware.org (Postfix) with ESMTPS id E8D2C3858C30 for ; Mon, 20 Feb 2023 15:55:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E8D2C3858C30 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=klomp.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=klomp.org Received: from r6.localdomain (82-217-174-174.cable.dynamic.v4.ziggo.nl [82.217.174.174]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id B5579301473D; Mon, 20 Feb 2023 16:55:42 +0100 (CET) Received: by r6.localdomain (Postfix, from userid 1000) id 8BE8F340221; Mon, 20 Feb 2023 16:55:42 +0100 (CET) From: Mark Wielaard To: elfutils-devel@sourceware.org Cc: Evgeny Vereshchagin , Aleksei Vetrov , Mark Wielaard Subject: [PATCH 2/2] libdw: Use elf_rawdata when checking .debug section Date: Mon, 20 Feb 2023 16:55:18 +0100 Message-Id: <20230220155518.86598-3-mark@klomp.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230220155518.86598-1-mark@klomp.org> References: <20230220155518.86598-1-mark@klomp.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3036.0 required=5.0 tests=BAYES_00,GIT_PATCH_0,JMQ_SPF_NEUTRAL,KAM_DMARC_STATUS,RCVD_IN_BARRACUDACENTRAL,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: .debug sections are raw bytes and don't need conversion even when host and file have different endian order. Signed-off-by: Mark Wielaard --- libdw/ChangeLog | 4 ++++ libdw/dwarf_begin_elf.c | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/libdw/ChangeLog b/libdw/ChangeLog index e0cd8f21..5e60f786 100644 --- a/libdw/ChangeLog +++ b/libdw/ChangeLog @@ -1,3 +1,7 @@ +2023-02-20 Mark Wielaard + + * dwarf_begin_elf.c (check_section): Use elf_rawdata. + 2023-02-14 Mark Wielaard * dwarf_getlocation.c (__libdw_intern_expression): Correct check diff --git a/libdw/dwarf_begin_elf.c b/libdw/dwarf_begin_elf.c index 1d4bb333..92d76d24 100644 --- a/libdw/dwarf_begin_elf.c +++ b/libdw/dwarf_begin_elf.c @@ -1,5 +1,6 @@ /* Create descriptor from ELF descriptor for processing file. Copyright (C) 2002-2011, 2014, 2015, 2017, 2018 Red Hat, Inc. + Copyright (C) 2023, Mark J. Wielaard This file is part of elfutils. This file is free software; you can redistribute it and/or modify @@ -242,8 +243,8 @@ check_section (Dwarf *result, size_t shstrndx, Elf_Scn *scn, bool inscngrp) } } - /* Get the section data. */ - Elf_Data *data = elf_getdata (scn, NULL); + /* Get the section data. Should be raw bytes, no conversion needed. */ + Elf_Data *data = elf_rawdata (scn, NULL); if (data == NULL) goto err; -- 2.39.2