Skip to content

Support AddressSanitizer#2890

Merged
chenBright merged 2 commits intoapache:masterfrom
chenBright:asan
Mar 26, 2025
Merged

Support AddressSanitizer#2890
chenBright merged 2 commits intoapache:masterfrom
chenBright:asan

Conversation

@chenBright
Copy link
Copy Markdown
Contributor

@chenBright chenBright commented Feb 9, 2025

What problem does this PR solve?

Issue Number: google/sanitizers#189

Problem Summary:

bthread需要额外适配ASan,不然会导致ASan误报。

What is changed and the side effects?

Changed:

  1. 在bthread创建、切换、销毁时,让ASan知道当前bthread的栈信息,主要用于维护fake stack
  2. 主动对对象池中的内存进行下毒/消毒:get_object时消毒、return_object下毒,可以排查出对象被归还之后还继续被使用的问题。此外,ExecutionQueue的cancel功能在设计上允许TaskNode被归还到对象池后还能继续被使用,所以支持通过ObjectPoolWithASanPoison模板对象来禁用下毒/消毒功能。
  3. 修复ASan发现的一些内存问题。
  4. 增加一个启用ASan的UT CI。

Side effects:

  • Performance effects(性能影响):

  • Breaking backward compatibility(向后兼容性):


Check List:

  • Please make sure your changes are compilable(请确保你的更改可以通过编译).
  • When providing us with a new feature, it is best to add related tests(如果你向我们增加一个新的功能, 请添加相关测试).
  • Please follow Contributor Covenant Code of Conduct.(请遵循贡献者准则).

@chenBright chenBright force-pushed the asan branch 5 times, most recently from 6c605ab to dc7b7f8 Compare February 11, 2025 04:01
@chenBright chenBright force-pushed the asan branch 3 times, most recently from 59a3c10 to 27487a6 Compare March 5, 2025 12:08
@chenBright
Copy link
Copy Markdown
Contributor Author

@wwbmmm 有空再看看

@wwbmmm
Copy link
Copy Markdown
Contributor

wwbmmm commented Mar 6, 2025

LGTM

@chenBright chenBright merged commit 7a7d1c8 into apache:master Mar 26, 2025
21 checks passed
@chenBright chenBright deleted the asan branch March 26, 2025 12:07
chenBright added a commit to chenBright/brpc that referenced this pull request Mar 27, 2025
* Support AddressSanitizer

* Add gperftools helper header
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants