rust/upb: harden extension mut lifetimes#26984
Open
Yenya030 wants to merge 3 commits intoprotocolbuffers:mainfrom
Open
rust/upb: harden extension mut lifetimes#26984Yenya030 wants to merge 3 commits intoprotocolbuffers:mainfrom
Yenya030 wants to merge 3 commits intoprotocolbuffers:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
rust/upb_kernel/extension.rsused explicit lifetime extension at the Rust/C arena boundary:This appeared in mutable extension paths and depended on a manual safety contract instead of structural lifetime propagation.
Why This Matters
This is a secure-by-design hardening change for latent lifetime unsoundness risk at an FFI ownership boundary.
What This PR Changes
rust/upb_kernel/extension.rstransmute(msg.get_arena(...)).'msglifetime structurally through message mut internals.rust/upb_kernel/message.rsrust/codegen_traits.rssrc/google/protobuf/compiler/rust/message.ccMessageMut::as_message_mut_inner(...) -> MessageMutInner<'msg, _>plumbing.rust/test/upb/extension_runtime_smoke_test.rsrust/test/upb/extension_lifetime_regression_test.rsrust/test/upb/BUILDrust/test/upb/extension_runtime_smoke_test.rsFieldType_String = 9(instead of10, which isGroup) when encoding the repeated string extension mini descriptor.Scope / Non-Goals