This is an archive of the discontinued LLVM Phabricator instance.

[asan] Intercept RtlRaiseException instead of kernel32!RaiseException
ClosedPublic

Authored by rnk on Aug 1 2016, 6:46 PM.

Details

Summary

On my install of Windows 10, RaiseException is a tail call to
kernelbase!RaiseException. Obviously, we fail to intercept that.
Instead, try hooking at the ntdll!RtlRaiseException layer. It is
unlikely that this layer will contain control flow.

Intercepting at this level requires adding a decoding for
'LEA ESP, [ESP + 0xXXXXXXXX]', which is a really obscure way to write
'SUB ESP, 0xXXXXXXXX' that avoids clobbering EFLAGS.

Diff Detail

Repository
rL LLVM

Event Timeline

rnk updated this revision to Diff 66416.Aug 1 2016, 6:46 PM
rnk retitled this revision from to [asan] Intercept RtlRaiseException instead of kernel32!RaiseException.
rnk updated this object.
rnk added a reviewer: etienneb.
rnk added a subscriber: llvm-commits.
etienneb accepted this revision.Aug 2 2016, 8:11 AM
etienneb edited edge metadata.

lgtm

This revision is now accepted and ready to land.Aug 2 2016, 8:11 AM
This revision was automatically updated to reflect the committed changes.