[PATCH] D91392: [hwasan] Fix Thread reuse (try 2).

Evgenii Stepanov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 12 15:39:47 PST 2020


eugenis created this revision.
eugenis added reviewers: pcc, hctim.
Herald added a project: Sanitizers.
Herald added a subscriber: Sanitizers.
eugenis requested review of this revision.

HwasanThreadList::DontNeedThread clobbers Thread::next_,
Breaking the freelist. As a result, only the top of the freelist ever
gets reused, and the rest of it is lost.

Since the Thread object with its associated ring buffer is only 8Kb, this is
typically only noticable in long running processes, such as fuzzers.

Fix the problem by switching from an intrusive linked list to a vector.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D91392

Files:
  compiler-rt/lib/hwasan/hwasan_thread.h
  compiler-rt/lib/hwasan/hwasan_thread_list.h
  compiler-rt/lib/sanitizer_common/sanitizer_common.h
  compiler-rt/lib/sanitizer_common/tests/sanitizer_common_test.cpp
  compiler-rt/test/hwasan/TestCases/Linux/reuse-threads.cpp
  compiler-rt/test/hwasan/TestCases/thread-uaf.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D91392.304987.patch
Type: text/x-patch
Size: 7061 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201112/fb99409d/attachment.bin>


More information about the llvm-commits mailing list