[SERVER-14850] Method invocation on null MutexDebugger is undefined behavior Created: 11/Aug/14 Updated: 16/May/16 Resolved: 12/Aug/14 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Internal Code |
| Affects Version/s: | None |
| Fix Version/s: | 2.7.5 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Andrew Morrow (Inactive) | Assignee: | Andrew Morrow (Inactive) |
| Resolution: | Done | Votes: | 0 |
| Labels: | undefined-sanitizer | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Backwards Compatibility: | Fully Compatible |
| Operating System: | ALL |
| Steps To Reproduce: | Run smokeCppUnittests under the undefined behavior sanitizer; many tests will emit the following: src/mongo/util/concurrency/mutex.h:127:17: runtime error: member call on null pointer of type 'mongo::MutexDebugger' |
| Participants: |
| Description |
|
In a _DEBUG build we enable the "MutexDebugger", which is invoked during Mutex operations. The MutexDebugger global object is an extern static in the mutex_debugger.cpp TU. There is no assurance that the static initializer for the global has run when methods are invoked. The MutexDebugger attempts to defend from this by checking if this == NULL, however, this is too late: https://github.com/mongodb/mongo/blob/master/src/mongo/util/concurrency/mutexdebugger.h#L90 since invoking a method on a null object is undefined behavior at the point of the call. We should evaluate the benefits of the MutexDebugger. If it is determined to be useful, we should fix it so that it has defined behavior. Otherwise, we should remove it, or add a ubsan suppression. |
| Comments |
| Comment by Githook User [ 12/Aug/14 ] |
|
Author: {u'username': u'acmorrow', u'name': u'Andrew Morrow', u'email': u'acm@mongodb.com'}Message: |