Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • M mu-impl-fast
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 40
    • Issues 40
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 1
    • Merge requests 1
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • Repository
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • mumu
  • mu-impl-fast
  • Issues
  • #72
Closed
Open
Issue created Aug 04, 2017 by Yi Lin@u4776528Owner

[x86_64] code patching atomicity

Commit a49d8ab6 added a naive code patching mechanism to the JIT compiler - it simply rewrites the code array. This is problematic as it leaves the instruction in an incoherent state before the instruction is completely overwritten.

One solution to this is to patch the first byte as INT3. The compiler then patches the rest bytes before it patches the first byte into expected instruction. If the patching is happening, and the instruction gets executed, it triggers a INT3 trap, and the execution will trap into signal handler with SIGSEGV. The signal handler will check if current instruction is INT3(0xCD); if so, it sets back the program counter, and re-execute the instruction. Thus the execution will not proceed unless the patching is finished.

Once I start implementing a signal handler for Zebu, I will implement this.

Assignee
Assign to
Time tracking