How to electrify your own fence: ProcessStrictHandleCheckPolicy

Raymond Chen

Raymond

During process termination, if you try to enter a critical section that is owned by another thread that has already been terminated, the gates are now electrified, and the kernel simply terminates your process.

We saw that an invalid handle error and an object type mismatch error both mean that your critical section is corrupted.

And as noted in a comment on the last linked article, there is an option (enabled by default for Store apps) to electrify the fences and raise a exception if an application tries to use an invalid handle or an invalid type of handle (for example, trying to Set­Event on a semaphore). Classic Win32 applications can opt into this behavior by calling Set­Process­Mitigation­Policy and asking for the Process­Strict­Handle­Check­Policy to be turned on.

0 comments

Comments are closed. Login to edit/delete your existing comments