Skip to content

Commit feeea91

Browse files
Add ThreadSanitizer usage note under Linux (#8908)
* Add ThreadSanitizer usage note under Linux --------- Co-authored-by: Max Hilbrunner <[email protected]>
1 parent 5e8062d commit feeea91

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

contributing/development/debugging/using_sanitizers.rst

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,40 @@ slower, while also multiplying memory usage by an approximately 8× factor.
140140
the address, memory and thread sanitizers are mutually exclusive. This means
141141
you can only use one of those sanitizers in a given binary.
142142

143+
.. note::
144+
145+
On Linux, if you stumble upon the following error:
146+
147+
``FATAL: ThreadSanitizer: unexpected memory mapping``
148+
149+
You may need to temporarily lower the Address Space Layout Randomization (ASLR) entropy in your system with:
150+
151+
.. code:: sh
152+
153+
sudo sysctl vm.mmap_rnd_bits=28
154+
155+
Or preferably disable it entirely with:
156+
157+
.. code:: sh
158+
159+
sudo sysctl kernel.randomize_va_space=0
160+
161+
And as soon as you are done with the thread sanitizer, increase the ASLR entropy with:
162+
163+
.. code:: sh
164+
165+
sudo sysctl vm.mmap_rnd_bits=32
166+
167+
Or re-enable ASLR with:
168+
169+
.. code:: sh
170+
171+
sudo sysctl kernel.randomize_va_space=2
172+
173+
Rebooting your machine will also revert the ASLR state to its default values.
174+
175+
It's important to revert the changes as soon as possible because lowering the ASLR entropy or disabling ASLR entirely can be a security risk.
176+
143177
Undefined behavior sanitizer (UBSAN)
144178
------------------------------------
145179

0 commit comments

Comments
 (0)