[PATCH] D149549: [compiler-rt][interception][win] Don't crash on unknown instructions

Alvin Wong via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 11 02:19:10 PDT 2023


alvinhochun added a comment.

Weirdly, that test XFAILs here on my i686-windows-msvc environment with check-asan (static runtime) because of different reasons:

- Before the parent patch D148990 <https://reviews.llvm.org/D148990>, it would fail because interception_win tries to hook the `strtol` function defined in the test source (despite the comment in the test saying that asan doesn't intercept it), but the function contains the unhandled instruction `89 e5`.
- After D148990 <https://reviews.llvm.org/D148990>, it now fails because the function is intercepted by asan, and asan calls `strtol` with `endptr` being non-null, which causes the `strlen` inside the if block to be called and it correctly detects a heap use-after-free.

It is possible that, on x86_64 static runtime asan was simply failing to hook the `strtol` function because of unhandled instructions, and this patch making it non-fatal means the test now happens to XPASS but for the completely wrong reason.

The stated XFAIL reason "defining strtoll in a static build results in linker errors" certainly does not seem to apply nowadays. I don't know the rationale behind having this test, but it seems to me should just be marked UNSUPPORTED for win32-static-asan, because sanitizers on Windows certainly do try to intercept statically-linked copies of libc functions, be it user-provided or not [1].

[1]: https://github.com/llvm/llvm-project/blob/eea5d9cc4188584cbfdc18a8bac5316596e70263/compiler-rt/lib/interception/interception_win.h#L74-L77


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D149549/new/

https://reviews.llvm.org/D149549



More information about the llvm-commits mailing list