-
Notifications
You must be signed in to change notification settings - Fork 343
[ASan] Fix issue where system log buffer was not cleared after reporting an issue. #983
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ASan] Fix issue where system log buffer was not cleared after reporting an issue. #983
Conversation
…ing 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 (cherry picked from commit 445b810)
@swift-ci please test |
@swift-ci Please test OS X platform |
We're hitting a network outage: https://forums.swift.org/t/unexpected-outage-on-ci-swift-org-3-26/34838 |
@swift-ci Please test OS X platform |
Hmm well the tests ran this time but the new fails.
@shahmishal Any idea why its not possible to query the local logs on the bot? |
Hmm actually I guess it's because the bot user is unprivileged. I've put up a fix to disable running the test if |
…queried. Summary: Follow up fix to 445b810. The `log show` command only works for privileged users so run a quick test of the command during lit config to see if the command works and only add the `darwin_log_cmd` feature if this is the case. Unfortunately this means the `asan/TestCases/Darwin/duplicate_os_log_reports.cpp` test and any other tests in the future that use this feature won't run for unprivileged users which is likely the case in CI. rdar://problem/55986279 Reviewers: kubamracek, yln, dcoughlin Subscribers: Charusso, #sanitizers, llvm-commits Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D76899 (cherry picked from commit 853a1e6)
@swift-ci Please test OS X platform |
Summary:
When ASan reports an issue the contents of the system log buffer
(
error_message_buffer
) get flushed to the system log (viaLogFullErrorReport()
). After this happens the buffer is not clearedbut 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 continueswithout clearing the buffer. This leads to problems if more ASan
issues are found and reported.
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.
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 whicheffectively 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
(cherry picked from commit 445b810)