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
  • #2814
Closed
Open
Issue created Jan 24, 2018 by Derek Bruening@derekbrueningContributor

drreg double-restoring for unreserved registers before and after barrier

When using the drreg "barrier" routines drreg_get_app_value(), drreg_restore_app_values(), and drreg_restore_app_aflags() with unreserved registers, drreg can end up double-restoring.

Here I insert instrumentation A, unreserve A's registers, restore A's registers to app values, and then sometimes insert instrumentation B, all before the next app instr.

In cases where there is no B we have a back-to-back restore:

 +114  m4 @0x0000563685ca7f58  65 48 8b 0c 25 18 00 mov    %gs:0x18[8byte] -> %rcx
                               00 00
 +123  m4 @0x0000563685cb7880  65 48 8b 14 25 10 00 mov    %gs:0x10[8byte] -> %rdx
                               00 00
 +132  m4 @0x0000563685cb70b8  3c 81                cmp    %al $0x81
 +134  m4 @0x0000563685ca7d48  9e                   sahf   %ah
 +135  m4 @0x0000563685cb7220  3c 81                cmp    %al $0x81
 +137  m4 @0x0000563685cb7a78  9e                   sahf   %ah
 +138  m4 @0x0000563685cb7a18  65 48 a1 98 00 00 00 mov    %gs:0x00000098[8byte] -> %rax
                               00 00 00 00
 +149  m4 @0x0000563685cb75f8  65 48 8b 0c 25 18 00 mov    %gs:0x18[8byte] -> %rcx
                               00 00
 +158  m4 @0x0000563685cb74c0  65 48 8b 14 25 10 00 mov    %gs:0x10[8byte] -> %rdx
                               00 00

When there is B, there's an extra restore after B.

drreg should mark native=true and give up the TLS slot on a get-app barrier call when the reg/aflags is unreserved to avoid this double-restore.

Assignee
Assign to
Time tracking