Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
    • Help
    • Support
    • Submit feedback
    • Contribute to GitLab
  • Sign in
M
mu-impl-fast
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 40
    • Issues 40
    • List
    • Boards
    • Labels
    • Milestones
  • Merge Requests 1
    • Merge Requests 1
  • Analytics
    • Analytics
    • Repository
    • Value Stream
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
  • mu
  • mu-impl-fast
  • Issues
  • #72

Closed
Open
Opened Aug 04, 2017 by Yi Lin@u4776528
  • Report abuse
  • New issue
Report abuse New issue

[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.

  • Discussion
  • Designs
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
1
Labels
bug
Assign labels
  • View project labels
Reference: mu/mu-impl-fast#72