Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-43883

Enable WiredTiger cursor copy debug mode in asan builds

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.4.0-rc1, 4.7.0
    • Affects Version/s: None
    • Component/s: Internal Code
    • None
    • Fully Compatible
    • v4.4
    • Execution Team 2020-02-24, Execution Team 2020-04-20

      There is a class of bug that results in using unowned BSON or RecordData objects, which reference memory owned by something else, and accessing that memory after it has been freed or overwritten. This has the potential to lead to undefined behavior and in-memory data corruption.

      See SERVER-42744, SERVER-43879, SERVER-43880, and SERVER-43882 for recent examples.

      We should enable WT cursor copy debug mode with the configuration "debug_mode=(cursor_copy=true)" on the call to wiredtiger_open.

       

      Old Description:
      We should create a build variant or suite that does the following:

      • Before freeing owned BSONObjs, overwrite the memory with garbage. This will blow up when an unowned BSONObjs is used after the owned object has been freed.
      • When returning data from a cursor, copy memory from WiredTiger into a managed buffer, and return that unowned buffer to the caller. When that cursor is invalidated in any way, from an advance, close, or reset, overwrite the buffer with garbage and free the memory immediately. This will blow up in cases where callers use data from cursors after repositioning or yielding. See an example implementation here.

            Assignee:
            daniel.gottlieb@mongodb.com Daniel Gottlieb (Inactive)
            Reporter:
            louis.williams@mongodb.com Louis Williams
            Votes:
            1 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: