Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adds traps for memory and division operations #840

Merged

Commits on Jun 1, 2018

  1. adds traps for memory and division operations

    Division by zero as well as faulty memory operations may terminate the
    Primus Machine. Previously we were just terminating it with a specific
    exception. However, this exceptions should actually be represented by
    an CPU/ABI-specific interrupt or trap. The proposed implementation
    provides a mechanism that allows:
    
    - trap the exception and translate it to a machine specific
      interrupt;
    
    - ignore or fix it;
    
    - catch it on a low-level.
    
    The mechanism is based on the same idea as in the Linker that used the
    primus_unresolved_handler to trap unresolved names. For each trap we
    provide a corresponding observation, that could be used to install the
    trap. The trap itself, is a special name, that could be linked (either
    on a permanent basis, or from the observation). If the trap hanlder is
    assigned, then it is invoked. Concrete behavior depends on a
    particular trap, e.g.,
    
    - for linker trap - the hanlder is invoked instead of the missing code;
    - for the division by zero - if the handler returns
      then the result is undefined;
    - for memory fault - the trap should fix the problem or terminate.
    
    We also introduce the Pagefault exception, to represent memory
    traps. We keep segfault as a non-maskable (non-preventable)
    exception.
    
    In addition, we have provided several new operations in the Linker
    interface:
    - unlink: for code unlinking, useful for removing traps
    - lookup: useful for restoring other's traps
    
    As a showcase, we also reimplemented some parts of the promiscuous
    mode. Now we use the pagefault trap to prevent segmentation
    faults. Also the fixing is more efficient as instead of mapping one
    byte pages, we are mapping pages with size of up to 4k.
    
    Besides others, this commit will also provide a fix for BinaryAnalysisPlatform#839.
    ivg committed Jun 1, 2018
    Configuration menu
    Copy the full SHA
    d6b29e1 View commit details
    Browse the repository at this point in the history

Commits on Jun 8, 2018

  1. Configuration menu
    Copy the full SHA
    27b0465 View commit details
    Browse the repository at this point in the history