Why can't clang enable all sanitizers?

前端 未结 1 1924
甜味超标
甜味超标 2021-02-06 23:41

Clang has various sanitizers that can be turned on to catch problems at runtime.
However, there are some sanitizers that I can\'t use together. Why is that?



        
1条回答
  •  被撕碎了的回忆
    2021-02-07 00:27

    I think the problem is that Asan and Msan both want to control the heap, and both want to reserve a large amount of memory to use as "shadow memory" which tracks the allocations and usage of the memory your program uses.

    They can't both be active because they would be trying to track the memory being used by the other sanitizer (which may not appear to be "safe" according to the rules that the sanitizer checks).

    It would also result in crazy memory usage, because both sanitizers would be allocating additional memory to track every byte your program uses.

    Maybe in theory they could be re-engineered to share a common framework so they can cooperate and not clash, but there are probably very good practical reasons why that would be difficult, or hurt performance.

    0 讨论(0)
提交回复
热议问题