[SERVER-33437] Decorable::declareDecorationWithOwner passes wrong owner pointer to its decorations Created: 22/Feb/18  Updated: 29/Oct/23  Resolved: 02/Mar/18

Status: Closed
Project: Core Server
Component/s: Internal Code
Affects Version/s: 3.7.2
Fix Version/s: 3.6.4

Type: Bug Priority: Major - P3
Reporter: Kaloian Manassiev Assignee: ADAM Martin (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-34512 Fix GDB decorable pretty printer Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Platforms 2018-02-26, Platforms 2018-03-12
Participants:

 Description   

The Decorable::declareDecorationWithOwner call instantiates a constructor function, which passes the owner pointer given to the decorations container here. However, since Decorable is a super class of the class it is enhancing, the this pointer points to where the super class starts, not where the actual decorated class is. Because of this, decorations with owner receive the wrong owner pointer here.



 Comments   
Comment by Githook User [ 02/Mar/18 ]

Author:

{'email': 'adam.martin@10gen.com', 'name': 'ADAM David Alan Martin', 'username': 'adamlsd'}

Message: SERVER-33437 Make Decorables not type-erased.

The current Decorable system type-erases the most derived (Decorated)
type when registering Decorations. This is illegal as derived classes
which are no longer standard-layout can have the `Decorable` base
class reordered with respect to the base address of their storage.

This also removes the "with-owner" forms of declaring a decoration,
which caused problems with layout. The decoration handles have
been modified to provide mechanisms to get back to the owner
directly, given a pointer or reference to the decoration.
Branch: master
https://github.com/mongodb/mongo/commit/2084f6702cd026bebe61818564814aac3e2f12a3

Comment by Githook User [ 02/Mar/18 ]

Author:

{'email': 'adam.martin@10gen.com', 'name': 'ADAM David Alan Martin', 'username': 'adamlsd'}

Message: SERVER-33437 Remove dependency upon decorable.

This is necessitated by the changes made to `Decorable<T>` which
makes the entire framework a header only library.
Branch: master
https://github.com/10gen/mongo-enterprise-modules/commit/22d0d2cb4f94893de5040289cc4530549c714faa

Generated at Thu Feb 08 04:33:24 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.