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
  • #4660
Closed
Open
Issue created Jan 07, 2021 by Derek Bruening@derekbrueningContributor

Avoid standard heap in droption and drcachesim init

While typical shared-library usage of DR isolates a client's heap from the app, when DR and clients are statically linked into the application there is unfortunately no way to isolate. We're already using placement new at runtime in drcachesim to support static usage. We'd been assuming that application heap usage at client init time was relatively safe, for internally-triggered attach where the init thread is at a clean ABI point. However, we have hit issues with application heap and tools that replace the allocator with a scheme involving SIGSEGV for detecting bugs. During attach, the init thread then raises SIGSEGV, running into signal delivery problems under #1921 (closed). While we plan to solve all the #1921 (closed) cases in any case, it may be worth providing app-heap-free options, for possible ptrace-attach with static DR or other cases where worse problems arise, or cases where clients need to parse options post-init-time.

Xref https://github.com/DynamoRIO/dynamorio/issues/4640#issuecomment-755728478 where using std::string with a custom allocator that invokes dr_global_alloc for all droption strings does not work with static DR, due to the static initializers that run natively at process init time. An allocator that looks at dynamo_heap_initialized does not work either, as it doesn't know how to free.

A possible solution is to store only literal char* types at init time and only construct std::string at parse time.

Beyond droption, func_trace has a std::vector and std::set which can easily be made to use a custom allocator.

We may want to make a C++ allocator that uses dr_global_heap part of a library exported by DR. Or bundled with droption.

Assignee
Assign to
Time tracking