Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support AddressSanitizer #2890

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Support AddressSanitizer #2890

wants to merge 2 commits into from

Conversation

chenBright
Copy link
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.(请遵循贡献者准则).

src/bthread/task_group.cpp Outdated Show resolved Hide resolved
src/butil/object_pool_inl.h Outdated Show resolved Hide resolved
test/bthread_execution_queue_unittest.cpp Outdated Show resolved Hide resolved
@chenBright chenBright force-pushed the asan branch 4 times, most recently from 98c114d to 6c605ab Compare February 11, 2025 02:48
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.

2 participants