瀏覽代碼

Add ThreadSanitizer usage note under Linux (#8908)

* Add ThreadSanitizer usage note under Linux

---------

Co-authored-by: Max Hilbrunner <[email protected]>
Wilson E. Alvarez 11 月之前
父節點
當前提交
feeea91cdf
共有 1 個文件被更改,包括 34 次插入0 次删除
  1. 34 0
      contributing/development/debugging/using_sanitizers.rst

+ 34 - 0
contributing/development/debugging/using_sanitizers.rst

@@ -140,6 +140,40 @@ slower, while also multiplying memory usage by an approximately 8× factor.
     the address, memory and thread sanitizers are mutually exclusive. This means
     the address, memory and thread sanitizers are mutually exclusive. This means
     you can only use one of those sanitizers in a given binary.
     you can only use one of those sanitizers in a given binary.
 
 
+.. note::
+
+    On Linux, if you stumble upon the following error:
+
+    ``FATAL: ThreadSanitizer: unexpected memory mapping``
+
+    You may need to temporarily lower the Address Space Layout Randomization (ASLR) entropy in your system with:
+
+    .. code:: sh
+
+        sudo sysctl vm.mmap_rnd_bits=28
+
+    Or preferably disable it entirely with:
+
+    .. code:: sh
+
+        sudo sysctl kernel.randomize_va_space=0
+
+    And as soon as you are done with the thread sanitizer, increase the ASLR entropy with:
+
+    .. code:: sh
+
+        sudo sysctl vm.mmap_rnd_bits=32
+
+    Or re-enable ASLR with:
+
+    .. code:: sh
+
+        sudo sysctl kernel.randomize_va_space=2
+
+    Rebooting your machine will also revert the ASLR state to its default values.
+
+    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.
+
 Undefined behavior sanitizer (UBSAN)
 Undefined behavior sanitizer (UBSAN)
 ------------------------------------
 ------------------------------------