[all-commits] [llvm/llvm-project] 69ebac: [win/asan] Don't intercept memset etc. in ntdll (#...

Hans Wennborg via All-commits all-commits at lists.llvm.org
Fri Dec 20 02:03:38 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 69ebac7ad6ae1db9bb19cf3a19ea978af6034ca3
      https://github.com/llvm/llvm-project/commit/69ebac7ad6ae1db9bb19cf3a19ea978af6034ca3
  Author: Hans Wennborg <hans at hanshq.net>
  Date:   2024-12-20 (Fri, 20 Dec 2024)

  Changed paths:
    M compiler-rt/lib/interception/interception_win.cpp

  Log Message:
  -----------
  [win/asan] Don't intercept memset etc. in ntdll (#120397)

When ntdll was added to the list of of "interesting DLLs" list (in
d58230b9dcb3b312a2da8f874daa0cc8dc27da9b), the intention was not to
intercept the "mini CRT" functions it exports. OverrideFunction would
only intercept the *first* function it found when searching the list of
DLLs, and ntdll was put last in that list.

However, after 42cdfbcf3e92466754c175cb0e1e237e9f66749e,
OverrideFunction intercepts *all* matching functions in those DLLs. As
a side-effect, the runtime would now intercept functions like memset
etc. also in ntdll.

This causes a problem when ntdll-internal functions like
RtlDispatchException call the intercepted memset, which tries to
inspect uncommitted shadow memory, raising an exception, and getting
stuck in that loop until the stack overflows.

Since we never intended to intercept ntdll's memset etc., the simplest
fix seems to be to actively ignore ntdll when intercepting those
functions.

Fixes #114793



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list