[PATCH] D26404: [asan/win] Add init hooks to .CRT$XLAB

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 8 09:38:03 PST 2016


rnk created this revision.
rnk added a reviewer: etienneb.
rnk added a subscriber: llvm-commits.
Herald added a subscriber: kubabrecka.

User applications may register hooks in the .CRT$XL* callback list,
which is called very early by the loader. This is very common in
Chromium:
https://cs.chromium.org/search/?q=CRT.XL&sq=package:chromium&type=cs

This has flown under the radar for a long time because the loader
appears to catch exceptions originating from these callbacks. It's a
real problem when you're debugging an asan application, though, since it
makes the program crash early.

The solution is to add our own callback to this list, and sort it very
early in the list like we do elsewhere. Also add a test with such an
instrumented callback, and test that it gets called with asan.


https://reviews.llvm.org/D26404

Files:
  lib/asan/asan_win.cc
  lib/asan/asan_win_dll_thunk.cc
  lib/asan/asan_win_dynamic_runtime_thunk.cc
  test/asan/TestCases/Windows/tls_init.cc

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26404.77206.patch
Type: text/x-patch
Size: 4867 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161108/a03b12fb/attachment.bin>


More information about the llvm-commits mailing list