• mdempsky's avatar
    Decouple Trap from ErrorCode · af240444
    mdempsky authored
    This CL makes a few changes in the direction of removing dependencies
    on ErrorCode by pushing them up a layer:
    
    - Trap now simply uses TrapKeys directly to store trap function and
    metadata instead of needlessly encoding them as ErrorCode.
    
    - MakeTrap returns a bare trap ID and it's instead the caller's
    responsibility to encode in an ErrorCode if needed, which is now
    handled by ErrorCode's trap constructor.
    
    - Also, ErrorCodeFromTrapId() is replaced by IsSafeTrapId() to answer
    the one question that SandboxBPF was interested in knowing about
    existing traps.
    
    - Change a few SandboxBPF trap-constructing functions into static
    functions since they don't depend on any SandboxBPF instance member
    variables.
    
    BUG=414363
    
    Review URL: https://codereview.chromium.org/572753002
    
    Cr-Commit-Position: refs/heads/master@{#295121}
    af240444
sandbox_bpf.h 14.2 KB