From: Mark Wielaard <mark@klomp.org>
To: elfutils-devel@sourceware.org
Cc: Evgeny Vereshchagin <evverx@gmail.com>,
Aleksei Vetrov <vvvvvv@google.com>,
Mark Wielaard <mark@klomp.org>
Subject: [PATCH 2/2] libdw: Use elf_rawdata when checking .debug section
Date: Mon, 20 Feb 2023 16:55:18 +0100 [thread overview]
Message-ID: <20230220155518.86598-3-mark@klomp.org> (raw)
In-Reply-To: <20230220155518.86598-1-mark@klomp.org>
.debug sections are raw bytes and don't need conversion even when host
and file have different endian order.
Signed-off-by: Mark Wielaard <mark@klomp.org>
---
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 <mark@klomp.org>
+
+ * dwarf_begin_elf.c (check_section): Use elf_rawdata.
+
2023-02-14 Mark Wielaard <mark@klomp.org>
* 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 <mark@klomp.org>
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
next prev parent reply other threads:[~2023-02-20 15:55 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-20 15:55 Fix some .debug checking and gnu hash xlate logic Mark Wielaard
2023-02-20 15:55 ` [PATCH 1/2] libelf: memmove any extra bytes left by elf_cvt_gnuhash conversion Mark Wielaard
2023-02-20 15:55 ` Mark Wielaard [this message]
2023-02-20 16:02 ` [PATCH 2/2] libdw: Use elf_rawdata when checking .debug section Aleksei Vetrov
2023-02-21 2:28 ` Evgeny Vereshchagin
2023-02-21 11:24 ` Mark Wielaard
2023-02-23 10:20 ` Mark Wielaard
2023-02-21 16:40 ` Aleksei Vetrov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230220155518.86598-3-mark@klomp.org \
--to=mark@klomp.org \
--cc=elfutils-devel@sourceware.org \
--cc=evverx@gmail.com \
--cc=vvvvvv@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).