[all-commits] [llvm/llvm-project] 445b81: [ASan] Fix issue where system log buffer was not c...

danliew via All-commits all-commits at lists.llvm.org
Thu Mar 26 10:56:39 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 445b810fbd4f1dad71fbdf96ba1c3b947417b884
      https://github.com/llvm/llvm-project/commit/445b810fbd4f1dad71fbdf96ba1c3b947417b884
  Author: Dan Liew <dan at su-root.co.uk>
  Date:   2020-03-26 (Thu, 26 Mar 2020)

  Changed paths:
    M compiler-rt/lib/asan/asan_report.cpp
    A compiler-rt/test/asan/TestCases/Darwin/duplicate_os_log_reports.cpp
    M compiler-rt/test/lit.common.cfg.py

  Log Message:
  -----------
  [ASan] Fix issue where system log buffer was not cleared after reporting an issue.

Summary:
When ASan reports an issue the contents of the system log buffer
(`error_message_buffer`) get flushed to the system log (via
`LogFullErrorReport()`). After this happens the buffer is not cleared
but this is usually fine because the process usually exits soon after
reporting the issue.

However, when ASan runs in `halt_on_error=0` mode execution continues
without clearing the buffer. This leads to problems if more ASan
issues are found and reported.

1. Duplicate ASan reports in the system log. The Nth (start counting from 1)
ASan report  will be duplicated (M - N) times in the system log if M is the
number of ASan issues reported.

2. Lost ASan reports. Given a sufficient
number of reports the buffer will fill up and consequently cannot be appended
to. This means reports can be lost.

The fix here is to reset `error_message_buffer_pos` to 0 which
effectively clears the system log buffer.

A test case is included but unfortunately it is Darwin specific because
querying the system log is an OS specific activity.

rdar://problem/55986279

Reviewers: kubamracek, yln, vitalybuka, kcc, filcab

Subscribers: #sanitizers, llvm-commits

Tags: #sanitizers

Differential Revision: https://reviews.llvm.org/D76749




More information about the All-commits mailing list