[SERVER-79328] Decorable refactor UBSAN fix: pass void* for backlinks Created: 25/Jul/23  Updated: 29/Oct/23  Resolved: 27/Jul/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 7.1.0-rc0

Type: Improvement Priority: Major - P3
Reporter: Billy Donahue Assignee: Billy Donahue
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on SERVER-78390 Decorable subsystem refactoring Closed
Backwards Compatibility: Fully Compatible
Sprint: Service Arch 2023-08-07
Participants:
Linked BF Score: 162

 Description   

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.



 Comments   
Comment by Githook User [ 27/Jul/23 ]

Author:

{'name': 'Billy Donahue', 'email': 'billy.donahue@mongodb.com', 'username': 'BillyDonahue'}

Message: SERVER-79328 Decorable USBSAN fix: pass void* to _setBackLink
Branch: master
https://github.com/mongodb/mongo/commit/dc96dacc03d401b99ee624dd84fa8b589f2d07e7

Generated at Thu Feb 08 06:40:42 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.