Status: New
Owner: ----
Labels: Type-Defect Priority-Medium
New issue 306 by [email protected]: asan deadlock in ScopedInErrorReport
destructor when print_stats=1
http://code.google.com/p/address-sanitizer/issues/detail?id=306
What steps will reproduce the problem?
1. export ASAN_OPTIONS=print_stats=1
2. Run programs under Linux. When generating error reports, asan stucks.
What is the expected output? What do you see instead?
Generates error reports and exit the program.
What version of the product are you using? On what operating system?
I run under GCC 4.9.
I check
http://llvm.org/svn/llvm-project/compiler-rt/trunk/lib/sanitizer_common and
find it not fixed.
Please provide any additional information below.
In asan_report.cc
class ScopedInErrorReport {
public:
ScopedInErrorReport() {
...
ASAN_ON_ERROR();
// Make sure the registry and sanitizer report mutexes are locked while
// we're printing an error report.
// We can lock them only here to avoid self-deadlock in case of
// recursive reports.
asanThreadRegistry().Lock(); //@@@@@lock once
CommonSanitizerReportMutex.Lock();
reporting_thread_tid = GetCurrentTidOrInvalid();
Printf("===================================================="
"=============\n");
}
// Destructor is NORETURN, as functions that report errors are.
NORETURN ~ScopedInErrorReport() {
// Make sure the current thread is announced.
DescribeThread(GetCurrentThread());
// Print memory stats.
if (flags()->print_stats)
__asan_print_accumulated_stats(); //@@@@@lock twice
if (error_report_callback) {
error_report_callback(error_message_buffer);
}
Report("ABORTING\n");
Die();
}
};
Since __asan_print_accumulated_stats() indirectly calls
GetAccumulatedStats(&stats), and
static void GetAccumulatedStats(AsanStats *stats) {
stats->Clear();
{
ThreadRegistryLock l(&asanThreadRegistry()); //the twice lock
asanThreadRegistry()
.RunCallbackForEachThreadLocked(MergeThreadStats, stats);
}
...
}
--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
--
You received this message because you are subscribed to the Google Groups
"address-sanitizer" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.