[PATCH] D76749: [ASan] Fix issue where system log buffer was not cleared after reporting an issue.

Dan Liew via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 25 15:44:16 PDT 2020


delcypher marked 2 inline comments as done.
delcypher added inline comments.


================
Comment at: compiler-rt/lib/asan/asan_report.cpp:58
 
+void ClearErrorMessageBuffer() {
+  BlockingMutexLock l(&error_message_buf_mutex);
----------------
vitalybuka wrote:
> static?
> or maybe just avoid a function 
The reason I made this a function is because I intend to refactor the logging support out of ASan into sanitizer_common so that UBSan has syslog support. However putting the logic inside a function at this stage is probably premature. I'll remove it.


================
Comment at: compiler-rt/lib/asan/asan_report.cpp:167
       internal_memcpy(buffer_copy.data(),
                       error_message_buffer, kErrorMessageBufferSize);
     }
----------------
vitalybuka wrote:
> I guess it should be reset here just after internal_memcpy under the same lock
That sounds reasonable. I placed my code later because there was already a block conditional on `halt_on_error_`. However what you suggested sounds better because it avoids any races where something writes to the buffer after it gets released here and where I added my code to clear the buffer.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76749





More information about the llvm-commits mailing list