Skip to content

Bugfix: Butex returned to ObjectPool triggers use-after-poison#3012

Merged
chenBright merged 1 commit into
apache:masterfrom
chenBright:fix_butex_poison
Jul 15, 2025
Merged

Bugfix: Butex returned to ObjectPool triggers use-after-poison#3012
chenBright merged 1 commit into
apache:masterfrom
chenBright:fix_butex_poison

Conversation

@chenBright

@chenBright chenBright commented Jun 30, 2025

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Issue Number: #2890

Problem Summary:

What is changed and the side effects?

Changed:

Butex object returned to the ObjectPool may be accessed, so ObjectPool can not poison the memory region of Butex.

Side effects:

  • Performance effects:

  • Breaking backward compatibility:


Check List:

@chenBright chenBright requested review from Copilot and wwbmmm July 14, 2025 09:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR prevents ASan from poisoning memory for TaskNode and Butex objects returned to their respective object pools, avoiding use-after-poison errors.

  • Adjusted comment style in execution_queue_inl.h for TaskNode::cancel().
  • Added ASan-poison specialization for bthread::Butex in butex.cpp.
  • Updated Chinese documentation with examples for disabling ASan poisoning on object pools.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
src/bthread/execution_queue_inl.h Refined comment formatting for TaskNode::cancel().
src/bthread/butex.cpp Added ObjectPoolWithASanPoison<bthread::Butex> specialization.
docs/cn/sanitizers.md Included example for disabling ASan poisoning on Butex.
Comments suppressed due to low confidence (1)

src/bthread/butex.cpp:131

  • Consider adding a unit or integration test to verify that the ASan poison specialization for Butex prevents poisoning as intended.
struct ObjectPoolWithASanPoison<bthread::Butex> : false_type {};

Comment thread docs/cn/sanitizers.md
Comment thread docs/cn/sanitizers.md
Comment thread src/bthread/butex.cpp
Comment thread src/bthread/butex.cpp
@wwbmmm

wwbmmm commented Jul 15, 2025

Copy link
Copy Markdown
Contributor

LGTM

@chenBright chenBright merged commit d95ede5 into apache:master Jul 15, 2025
25 of 27 checks passed
@chenBright chenBright deleted the fix_butex_poison branch July 15, 2025 06:05
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