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

Decorable refactor UBSAN fix: pass void* for backlinks

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 7.1.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible
    • Service Arch 2023-08-07
    • 162

      SERVER-78390 has a UBSAN true positive. It's not a runtime problem.

      We're downcasting a "this" pointer to its CRTP descendent in its CRTP base constructor, and the object is not yet an instance of that CRTP descendent, so this is incorrect. The backlink pointer is all reinterpret casts and lowlevel memory hacking anyway, so we can just pass a void* for this purpose and UBSAN has nothing to complain about. The downcast isn't needed until decoration.owner is called, which should be after the owner is constructed, and the downcast will be valid.

            Assignee:
            billy.donahue@mongodb.com Billy Donahue
            Reporter:
            billy.donahue@mongodb.com Billy Donahue
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: