Add HANDLE_FLAG_PROTECT_FROM_CLOSE flag to Tracked/ScopedHandle.
Idea here is to try and protect our scoped handles so that any third party close/accidental close could be some what restricted. Besides adding flag following changes are in this CL. 1. While launching test process (Python executable), we pass it a pipe handle which we add it to ScopedHandle before passing, this marked handle as protected, now when we let python process inherit that handle, python process cannot close it and throws exception. We now duplicate handle without protection and then pass it onto python process and let host process continue with protected scoped handle. 2. Other change is related to disabling of active verifier dynamically. If ActiveVerifier gets invoked before disabling it (because someone used scoped handle before instruction pointer reached to UseHooks/InstallCloseHandleHooks) then it protects handle from closing. If now we disable ActiveVerifier when scoped handle goes out of scope, it tries to stop tracking handle, but in this case as active verifier got disabled later, that particular handle remains protected. Now we don't disable active verifier dynamically, but just decide on setting up of CloseHandleHook based on certain parameters. BUG=475872 R=cpu@chromium.org,rvargas@chromium.org Review URL: https://codereview.chromium.org/1113063004 Cr-Commit-Position: refs/heads/master@{#329516}
Showing
Please register or sign in to comment