konrad-kruczynski / elfsharp

Pure managed C# library for reading ELF, UImage, Mach-O binaries.
https://elfsharp.it
Other
150 stars 56 forks source link

Doesn't read all notes from ARM core dump file #83

Closed jerkerolofsson closed 2 years ago

jerkerolofsson commented 2 years ago

Using readelf:

readelf -n adbd_3124.core

Displaying notes found at file offset 0x00000db4 with length 0x00001b48: Owner Data size Description CORE 0x00000094 NT_PRSTATUS (prstatus structure) CORE 0x0000007c NT_PRPSINFO (prpsinfo structure) CORE 0x00000080 NT_SIGINFO (siginfo_t data) CORE 0x00000098 NT_AUXV (auxiliary vector) CORE 0x00000bb2 NT_FILE (mapped files) ...

Using ElfSharp, I only get a single note:

var elfFile = ELFSharp.ELF.ELFReader.Load(path);
var notes = elfFile.Segments.Where(x => x.Type == ELFSharp.ELF.Segments.SegmentType.Note).ToList();

Core dump file: https://ufile.io/f14kd6c0

jerkerolofsson commented 2 years ago

I added support for this in PR#87.

The ELF coredump file contains multiple entries in a single NOTE segment. But only the first NoteData is read inside NoteSegment and exposed from the NoteName, NoteType and NoteDescription properties.

The PR loads all NoteData within the segment and adds a new property on the NoteSegment that returns a ReadOnly list of the NoteData.

I kept the NoteName/NoteType/NoteDescription properties for backwards compatibility and they will still contain the first note within the segment.

konrad-kruczynski commented 2 years ago

Great, thanks for your input and also caring about the backwards compatibility (so I don't have to change major library version). I'm not sure if I'll be able to review PR right away but will surely do it eventually.

konrad-kruczynski commented 2 years ago

We can close it now.