[PATCH] D91208: [hwasan] Fix Thread reuse.

Evgenii Stepanov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 10 14:19:19 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 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/D91208

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: D91208.304329.patch
Type: text/x-patch
Size: 7071 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201110/564270dc/attachment-0001.bin>


More information about the llvm-commits mailing list