Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • D dynamorio
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,467
    • Issues 1,467
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 44
    • Merge requests 44
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • DynamoRIO
  • dynamorio
  • Issues
  • #4137
Closed
Open
Issue created Feb 26, 2020 by Administrator@rootContributor

`dr_get_process_id` doesn't return the expected result in `thread_exit_event` callbacks

Created by: petrochenkov

Citing the documentation of void dr_register_thread_exit_event ( void(*)(void *drcontext) func ) :

The passed-in drcontext should be used instead of calling dr_get_current_drcontext(), as the thread exit event may be invoked from other threads, and using dr_get_current_drcontext() can result in failure to clean up the right resources, and at process exit time it may return NULL.

The dr_get_process_id API doesn't take a drcontext parameter, so it's effectively using "the current context" when being called from thread exit callbacks, which is not recommended.

This can lead to pretty confusing results when DynamoRIO reports different process IDs for the same thread ID at different points.

Possible solution: introduce a version of dr_get_process_id taking a void* drcontext parameter that would work exactly like thread_id_t dr_get_thread_id ( void * drcontext ), but would return dcontext->owning_process rather than dcontext->owning_thread.

Assignee
Assign to
Time tracking