This is an archive of the discontinued LLVM Phabricator instance.

[compiler-rt] Add internal wcslen to avoid crashing on windows 64-bits
ClosedPublic

Authored by etienneb on Jul 14 2016, 8:47 AM.

Details

Summary

The function wcslen is incorrectly hooked on windows 64-bits.

The interception library is not able to hook without breaking the code.
The function is too small and the interception must be done with
trampoline-hooking which turned out to be incorrect on a small
loop (first few instructions have a backedge).

Diff Detail

Event Timeline

etienneb updated this revision to Diff 63985.Jul 14 2016, 8:47 AM
etienneb retitled this revision from to [compiler-rt] Add internal wcslen to avoid crashing on windows 64-bits.
etienneb updated this object.
etienneb added a reviewer: rnk.
rnk accepted this revision.Jul 14 2016, 8:54 AM
rnk edited edge metadata.

lgtm

lib/asan/asan_win_dll_thunk.cc
384 ↗(On Diff #63985)

unrelated?

This revision is now accepted and ready to land.Jul 14 2016, 8:54 AM
etienneb updated this revision to Diff 63988.Jul 14 2016, 9:02 AM
etienneb edited edge metadata.

remove useless change

etienneb updated this revision to Diff 63989.Jul 14 2016, 9:03 AM

right fix

rnk added inline comments.Jul 14 2016, 9:07 AM
lib/asan/asan_interceptors.cc
588

Eh, I don't think we need an ifdef, we can always use internal_wcslen. Better to be consistent. Nobody uses wcslen on Unix anyway. We added this interceptor for Windows.

etienneb closed this revision.Jul 14 2016, 3:20 PM
In D22363#484241, @rnk wrote:

lgtm

lib/asan/asan_interceptors.cc
588

landed here: Committed revision 275492.

lib/asan/asan_win_dll_thunk.cc
384 ↗(On Diff #63985)

Bad patch editing.
This is the next patch.