when guards are dropped out of order the original function is never restored · Issue #6 · mehcode/guerrilla · GitHub
Skip to content

when guards are dropped out of order the original function is never restored #6

Open

Description

@kazcw

This is inherent to the API, as there's no reasonable interpretation of what version to "restore" in such a case; so it might just be one for the "no monkey business" section of the manual

Activity

  1. mehcode commented on Nov 10, 2018

    @mehcode
    Owner

    We should probably at least use a mutex keyed to the target function address.

  2. kazcw commented on Nov 10, 2018

    @kazcw
    Author

    Stacked patches of the same function would trigger Mutex::lock's unspecified behavior, and dynamically-created mutexes wouldn't help the thread safety issues.

    If there were a singleton Patcher object, the borrow checker could ensure stacked guards aren't dropped out of order. Sharing the Patcher between threads would require protecting it with a Mutex, which would eliminate some of the possible race conditions (the read/write one, and also the mprotect/write one, but not the write/execute one).

  3. added a commit that references this issue on Nov 10, 2018
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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions