Closed Tomal-kuet closed 6 months ago
Can you post a minimal reproducer binary that demonstrates this behavior?
Can you try running pyelftools' own readelf
clone on it? It's in the scripts
directory
Looks similar to #484, which was addressed by #491. "Tag" in this context stands for ARM attribute tags, not for DWARF tags. Cortex is a flavor of ARM.
ARM tag 48 is TAG_MVE_ARCH (https://github.com/ARM-software/abi-aa/blob/main/addenda32/addenda32.rst), handled as the rest of them. We indeed don't have it. To address by monkeypatching, add a value to ENUM_ATTR_TAG_ARM
under elftools/elf/enums.py:
import elftools.elf.enums
elftools.elf.enums.ENUM_ATTR_TAG_ARM['TAG_MVE_ARCH'] = 48
Thank you very much. I directly added TAG_MVE_ARCH = 48
in the ENUM_ATTR_TAG_ARM of elftools/elf/enums.py
python file. It works.
@sevaa should we add it?
I think I will go over the list of tags and add all the missing tag codes (unless the tag value requires nontrivial parsing). "One reindeer is a coincidence, two reindeer constitute a trend", as the joke goes.
There are two more missing tags.
Feel free to look them up in the linked ARM document. I'll do a PR in the meantime.
I fixed those tags, which were for the PACBTI extension in Cortex-m85.
I am trying to construct CFG using angr for Cortex-m85 binary compiled with ARM LLVM Embedded Toolchain clang 16.0.0. I am getting the following error:
elftools.common.exceptions.ELFParseError: no decoding mapping for 48 [tag]
The angr python code:
proj = angr.Project('my_binary.axf', main_opts={'arch': 'ArchARMCortexM'})
or
angr version:
9.2.91
elftools version:0.30
Can anyone please tell me what I am doing wrong?
Below is the readelf output: