[SERVER-31434] Give mongo::Value at least pointer alignment Created: 06/Oct/17  Updated: 30/Oct/23  Resolved: 16/Oct/17

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 3.4.17, 3.6.0-rc1

Type: Bug Priority: Major - P3
Reporter: Mark Benvenuto Assignee: Mathias Stearn
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v3.4, v3.2
Sprint: Repl 2017-10-23
Participants:
Linked BF Score: 0

 Description   

The Value type holds pointers but currently has alignment of 1. Since LSAN by default only looks for pointers in aligned addresses, it can report false-positive leaks of memory pointed to by a misaligned Value. This will be fixed by giving Value at least pointer alignment.

Original title: Use use_unaligned for LSAN

Original Description:

Pointers to the RCString class may be stored in memory not aligned to 8 bytes, and therefore LSAN does not mark the RCString as reachable. This results in false positive leak reports.

To fix, pass "use_unaligned=1" in the LSAN_OPTIONS environment variable.

See
https://github.com/llvm-mirror/compiler-rt/blob/b3c632084941e7b9669416f91c7f90b7fcd49645/lib/lsan/lsan_common.cc#L160-L165
https://github.com/llvm-mirror/compiler-rt/blob/b3c632084941e7b9669416f91c7f90b7fcd49645/lib/lsan/lsan_common.h#L71-L73



 Comments   
Comment by Githook User [ 24/Jul/18 ]

Author:

{'name': 'Mathias Stearn', 'email': 'mathias@10gen.com', 'username': 'RedBeard0531'}

Message: SERVER-31434 Give Value and ValueStorage pointer alignment

(cherry picked from commit 068afad15322f6e768cafdfde76dfa92575a17cf)
Branch: v3.4
https://github.com/mongodb/mongo/commit/73d0465bb1f5a90a8fd8848da23434723c9dd7b6

Comment by Mathias Stearn [ 16/Oct/17 ]

Requesting backport to avoid false-positive LSAN leak errors in old branches

Comment by Githook User [ 16/Oct/17 ]

Author:

{'email': 'mathias@10gen.com', 'name': 'Mathias Stearn', 'username': 'RedBeard0531'}

Message: SERVER-31434 Give Value and ValueStorage pointer alignment
Branch: master
https://github.com/mongodb/mongo/commit/068afad15322f6e768cafdfde76dfa92575a17cf

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