To improve stack walking heuristics we'd like to validate ambiguous instruction pointers by checking if they fall within an executable reason. On Windows this is already possible because windbg.dll populates the MemoryInfoListStream with the whole state of the process' memory when it snapshots it. On Linux we currently have /proc/self/maps which contains the required information but we'd have to parse it in the stackwalker to yield the same information. Alternatively we might try and populate the MemoryInfoListStream on Linux too in order to be able to use the same code across different platforms.
Populating the stream should be relatively simple, info regarding the header and entries are readily available. The biggset issue is that the AllocationProtect, State, Protect and Type fields are supposed to contain Windows-specific constants. There's two ways to tackle this: either we use those fields to store Linux-specific constants - but that would defeat the purpose of having identical code for all platforms in the stack walker - or we map them to their closest Windows equivalents. Interestingly crashpad does the latter for fuchsia but it does not populate the stream on Linux and macOS.
To improve stack walking heuristics we'd like to validate ambiguous instruction pointers by checking if they fall within an executable reason. On Windows this is already possible because windbg.dll populates the
MemoryInfoListStreamwith the whole state of the process' memory when it snapshots it. On Linux we currently have/proc/self/mapswhich contains the required information but we'd have to parse it in the stackwalker to yield the same information. Alternatively we might try and populate theMemoryInfoListStreamon Linux too in order to be able to use the same code across different platforms.Populating the stream should be relatively simple, info regarding the header and entries are readily available. The biggset issue is that the
AllocationProtect,State,ProtectandTypefields are supposed to contain Windows-specific constants. There's two ways to tackle this: either we use those fields to store Linux-specific constants - but that would defeat the purpose of having identical code for all platforms in the stack walker - or we map them to their closest Windows equivalents. Interestingly crashpad does the latter for fuchsia but it does not populate the stream on Linux and macOS.