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

Decoration alignment calculation should consider internal backlink pointer

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 8.1.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Workload Scheduling
    • Fully Compatible
    • ALL
    • Workload Scheduling 2024-08-05, Workload Scheduling 2024-08-19

      The first entry in the decoration buffer's _data pointer is type-erase void* backlink to the decorated object. Therefore, the minimum alignment for the _data allocation should be alingof(void*), not 1, as it is today. 

       

      If a decorable in the codebase has all decorations with alignment requirement less than alignof(void*) (generally 8 bytes), then it is possible that we would pass an alignment of 1 to operator new when constructing the _data buffer underlying the DecorationBuffer, which means future accesses to objects in the buffer could be misaligned, generating undefined behavior. This could lead to crashes, or in the worst case writing to invalid memory locations.   

            Assignee:
            george.wangensteen@mongodb.com George Wangensteen
            Reporter:
            george.wangensteen@mongodb.com George Wangensteen
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: