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

Breaking Change: Add ASAN poisoning after clearing oneof messages on arena. #18864

Merged
merged 1 commit into from
Oct 25, 2024

Conversation

copybara-service[bot]
Copy link

@copybara-service copybara-service bot commented Oct 16, 2024

Breaking Change: Add ASAN poisoning after clearing oneof messages on arena.

Note:
This change primarily affects debug + ASAN builds using protobuf arenas.
If this change causes a crash in your debug build, it probably means that
there is a use-after-free bug in your program. This change has already been
implemented and battle-tested within Google for some time.

Oneof messages on the regular heap should not be affected because the memory
they hold are already deleted. Users will already see use-after-free errors
if they attempt to access heap-allocated oneof messages after calling Clear().

When a protobuf message is cleared, all raw pointers should be invalidated
because undefined things may happen to any of the fields pointed to by
mutable_foo() APIs. While destructors may not necessarily be invoked, Clear()
should be considered a pointer invalidation event.

#test-continuous

@copybara-service copybara-service bot force-pushed the test_686587486 branch 2 times, most recently from 652a788 to 36bd51d Compare October 24, 2024 20:28
@copybara-service copybara-service bot changed the title Open source ASAN poisoning on calling message.Clear(). Breaking Change: Open source ASAN poisoning after clearing oneof messages. Oct 24, 2024
@copybara-service copybara-service bot changed the title Breaking Change: Open source ASAN poisoning after clearing oneof messages. Breaking Change: Add ASAN poisoning after clearing oneof messages on arena. Oct 24, 2024
…arena.

Note:
  This change primarily affects debug + ASAN builds using protobuf arenas.
  If this change causes a crash in your debug build, it probably means that
  there is a use-after-free bug in your program. This change has already been
  implemented and battle-tested within Google for some time.

  Oneof messages on the regular heap should not be affected because the memory
  they hold are already deleted. Users will already see use-after-free errors
  if they attempt to access heap-allocated oneof messages after calling Clear().

When a protobuf message is cleared, all raw pointers should be invalidated
because undefined things may happen to any of the fields pointed to by
mutable_foo() APIs. While destructors may not necessarily be invoked, Clear()
should be considered a pointer invalidation event.

#test-continuous

PiperOrigin-RevId: 689569669
@copybara-service copybara-service bot merged commit 54d068e into main Oct 25, 2024
1 check passed
@copybara-service copybara-service bot deleted the test_686587486 branch October 25, 2024 00:19
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.

1 participant