8000 Evaluate writing out a MemoryInfoListStream · Issue #8 · rust-minidump/minidump-writer · GitHub
[go: up one dir, main page]

Skip to content
7FFF

Evaluate writing out a MemoryInfoListStream #8

Closed

Description

@gabrielesvelto

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 do 8000 es the latter for fuchsia but it does not populate the stream on Linux and macOS.

Activity

  1. luser commented on Mar 22, 2022

    @luser

    If someone writes a useful parser for maps you could just reuse the same implementation in this crate + the stackwalker. :)

  2. afranchuk commented on Jan 9, 2023

    @afranchuk
    Collaborator

    @luser Would minidump-common be an okay common place for the maps parser? Or should it be a separate crate entirely?

  3. luser commented on Jan 10, 2023

    @luser

    That doesn't quite feel like the right place for it, since currently minidump-common is mostly type definitions.

    n.b.: @Gankra implemented stackwalker parsing of this along with a unified interface atop that + MemoryInfoListStream in rust-minidump/rust-minidump#268 . See also rust-minidump/rust-minidump#256

  4. afranchuk commented on Jan 10, 2023

    @afranchuk
    Collaborator

    I agree, I was asking on the off-chance that others didn't agree with my thought so it'd be simpler :)

    Thanks for the info, I was aware of the existing impl. I was just going to move it somewhere common and maybe slightly clean up the interface so that it could be used in minidump-writer!

  5. afranchuk commented on Jan 10, 2023

    @afranchuk
    Collaborator

    Any suggestion on crate name/location? Alternatively, maybe we could contribute to the procfs crate and expose its process::MemoryMap::from_line() implementation?

  6. gabrielesvelto commented on Jan 16, 2023

    @gabrielesvelto
    ContributorAuthor

    Contributing to an external crate sounds like a good idea if the crate is sufficiently widespread and useful. We parse /proc files in a lot of places within Firefox code and the procfs crate sounds like something we'll end up using eventually.

  7. afranchuk commented on Jan 16, 2023

    @afranchuk
    Collaborator

    Yeah, I figured with the other procfs needs we have, it'd be great to take advantage of procfs. My only hesitation is that procfs describes itself as a crate for accessing the current system's procfs mount, so I'd like to confirm with the main developers as to whether they'd be okay with expanding the purpose of the crate (I don't expect anyone would have a problem with it, but it's best to confirm).

  8. afranchuk commented on Jan 18, 2023

    @afranchuk
    Collaborator

    The procfs team seems open to contribution along these lines, so that is probably the path to follow.

  9. gabrielesvelto commented on Jan 20, 2023

    @gabrielesvelto
    ContributorAuthor

    The procfs team seems open to contribution along these lines, so that is probably the path to follow.

    Excellent!

  10. afranchuk commented on Feb 8, 2023

    @afranchuk
    Collaborator

    I'm currently waiting (patiently, there's no rush) for procfs to tag a new version. Then this can proceed.

  11. eminence commented on Feb 9, 2023

    @eminence

    procfs maintainer here 👋 To set some rough expectations, I'm going to try to get a new release of procfs out within a week. Thanks to @afranchuk who did the implementation within procfs

  12. afranchuk commented on Feb 9, 2023

    @afranchuk
    Collaborator

    @eminence thanks for chiming in with an update! I will set a reminder to check on things in a week.

  13. added a commit that references this issue on Feb 24, 2023
    3d0fcaf
  14. added a commit that references this issue on Apr 19, 2023
    98b2395
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0