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
  • Merge requests
  • !4703

i#2666: Dynamically size CONTEXT buffers

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Derek Bruening requested to merge i2666-dynamic-sized-context into master Feb 01, 2021
  • Overview 2
  • Commits 1
  • Pipelines 0
  • Changes 5

Changes all stack buffers using hardcoded sizes for CONTEXT to instead use heap-allocated buffers sized to match the kernel's actual CONTEXT size for the given flags.

Adds a mechanism to query the CONTEXT64 size from 32-bit DR using switch_modes_and_call().

The one place where we can't easily use heap is thread_set_self_mcontext() because it doesn't return and we thus do not have a simple way to free the buffer. There, we use a large 4096-byte stack buffer, and we check the size needed: if it's larger than that, we use a lost heap allocation and issue a debug build warning which should alert someone. If we end up needing more space there in the future we may want to store a pointer in the dcontext and have a special check to free it or something.

Fixes #2666 (closed)

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: i2666-dynamic-sized-context