![当使用 LD_PRELOAD 预加载 clang AddressSanitizer 库时,为什么 pgrep 挂起?](https://linux22.com/image/191984/%E5%BD%93%E4%BD%BF%E7%94%A8%20LD_PRELOAD%20%E9%A2%84%E5%8A%A0%E8%BD%BD%20clang%20AddressSanitizer%20%E5%BA%93%E6%97%B6%EF%BC%8C%E4%B8%BA%E4%BB%80%E4%B9%88%20pgrep%20%E6%8C%82%E8%B5%B7%EF%BC%9F.png)
我注意到当我设置 LD_PRELOAD 环境时。变量 libclang_rt.asan-x86_64.so pgrep 挂起。
为什么会发生这种情况以及如何避免这种情况?
senx:/$ time pgrep anything
real 0m0,022s
user 0m0,001s
sys 0m0,020s
senx:/$ export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libasan.so.4
senx:/$ time pgrep anything
real 0m0,076s
user 0m0,033s
sys 0m0,027s
senx:/$ export LD_PRELOAD=/usr/lib/llvm-10/lib/clang/10.0.0/lib/linux/libclang_rt.asan-x86_64.so
senx:/$ time pgrep anything
^C
real 0m33,077s
user 0m0,010s
sys 0m0,010s