Repository navigation
Fix buffer and scoped interface pointer provenance - #5242
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the pointer-provenance changes in generated bindings and scoped interfaces.
No open issues 🎉
What changed in this PR
This PR addresses pointer-provenance problems related to #5189 in generated Windows bindings and scoped interfaces, with regression coverage in Miri.
Changes:
- Derive optional writable-buffer pointers from mutable borrows and regenerate affected bindings.
- Preserve allocation pointers when constructing scoped interfaces in bindgen and
#[interface]. - Add buffer and scoped-interface regressions, with Miri checks under Stacked Borrows and Tree Borrows.
| File | Description |
|---|---|
crates/tests/libs/bindgen/src/provenance_tests.rs |
Adds buffer-write and scoped-interface lifetime regressions. |
crates/tests/libs/bindgen/src/lib.rs |
Registers provenance tests. |
crates/tests/libs/bindgen/input/optional_buffers.rdl |
Defines optional-buffer and scoped-interface fixtures. |
crates/tests/libs/bindgen/expected/unspecified_direction.rs |
Updates expected scoped construction. |
crates/tests/libs/bindgen/expected/type_closure.rs |
Updates expected scoped construction. |
crates/tests/libs/bindgen/expected/type_closure_shallow.rs |
Updates expected scoped construction. |
crates/tests/libs/bindgen/expected/type_closure_minimal.rs |
Updates expected scoped construction. |
crates/tests/libs/bindgen/expected/string_aliases.rs |
Updates expected scoped construction. |
crates/tests/libs/bindgen/expected/query_buffers.rs |
Updates expected scoped construction. |
crates/tests/libs/bindgen/expected/optional_buffers.rs |
Adds expected buffer wrappers and scoped constructors. |
crates/tests/libs/bindgen/expected/native_references.rs |
Updates expected scoped construction. |
crates/tests/libs/bindgen/expected/method_return.rs |
Updates expected scoped construction. |
crates/tests/libs/bindgen/expected/method_params.rs |
Updates expected scoped construction. |
crates/tests/libs/bindgen/expected/interface_required.rs |
Updates expected scoped constructors. |
crates/tests/libs/bindgen/expected/interface_out_array.rs |
Updates expected scoped constructors. |
crates/tests/libs/bindgen/expected/implement_pattern.rs |
Updates expected scoped construction. |
crates/tests/libs/bindgen/expected/com_interface.rs |
Updates expected scoped construction. |
crates/tests/libs/bindgen/expected/com_implement.rs |
Updates expected scoped construction. |
crates/tests/libs/bindgen/expected/buffer_relationships.rs |
Updates expected scoped construction. |
crates/tests/libs/bindgen/expected/buffer_contracts.rs |
Updates expected scoped constructors. |
crates/libs/windows/src/Windows/Win32/xaudio2/mod.rs |
Preserves allocation pointers in XAudio2 scoped constructors. |
crates/libs/windows/src/Windows/Win32/wmcodecdsp/mod.rs |
Uses mutable pointers for optional codec-string buffers. |
crates/libs/windows/src/Windows/Win32/winspool/mod.rs |
Uses mutable pointers for optional package-path buffers. |
crates/libs/windows/src/Windows/Win32/winsock2/mod.rs |
Fixes optional socket-registration buffer pointers. |
crates/libs/windows/src/Windows/Win32/wincrypt/mod.rs |
Fixes the optional encryption-buffer pointer. |
crates/libs/windows/src/Windows/Win32/wincodecsdk/mod.rs |
Fixes optional metadata-information buffer pointers. |
crates/libs/windows/src/Windows/Win32/wincodec/mod.rs |
Fixes optional imaging buffer pointers. |
crates/libs/windows/src/Windows/Win32/winbase/mod.rs |
Fixes the optional audit object-type buffer pointer. |
crates/libs/windows/src/Windows/Win32/vswriter/mod.rs |
Preserves allocation pointers in VSS scoped constructors. |
crates/libs/windows/src/Windows/Win32/usp10/mod.rs |
Fixes the optional fixed-size layout-buffer pointer. |
crates/libs/windows/src/Windows/Win32/shobjidl_core/mod.rs |
Fixes the optional rename-buffer pointer. |
crates/libs/windows/src/Windows/Win32/securitybaseapi/mod.rs |
Fixes optional access-check buffer pointers. |
crates/libs/windows/src/Windows/Win32/sapiddk/mod.rs |
Preserves allocation pointers in speech-task scoped constructors. |
crates/libs/windows/src/Windows/Win32/sapi/mod.rs |
Preserves the speech-callback allocation pointer. |
crates/libs/windows/src/Windows/Win32/ro/mod.rs |
Preserves allocation pointers in metadata scoped constructors. |
crates/libs/windows/src/Windows/Win32/oledb/mod.rs |
Fixes optional property-set buffer pointers. |
crates/libs/windows/src/Windows/Win32/memoryapi/mod.rs |
Fixes optional extended-parameter buffer pointers. |
crates/libs/windows/src/Windows/Win32/gdiplustypes/mod.rs |
Preserves the GDI+ callback allocation pointer. |
crates/libs/windows/src/Windows/Win32/esent/mod.rs |
Fixes the optional column-retrieval buffer pointer. |
crates/libs/windows/src/Windows/Win32/d3dcommon/mod.rs |
Preserves the include-handler allocation pointer. |
crates/libs/windows/src/Windows/Win32/d3d12/mod.rs |
Preserves allocation pointers in reflection scoped constructors. |
crates/libs/windows/src/Windows/Win32/d3d11/mod.rs |
Preserves allocation pointers in reflection scoped constructors. |
crates/libs/windows/src/Windows/Win32/d3d10/mod.rs |
Preserves allocation pointers in effect and reflection constructors. |
crates/libs/windows/src/Windows/Win32/bcrypt/mod.rs |
Fixes optional initialization-vector buffer pointers. |
crates/libs/interface/src/generation.rs |
Generates scoped interfaces from raw allocation pointers. |
crates/libs/bindgen/src/types/cpp_method.rs |
Generates mutable borrows for optional writable buffers. |
crates/libs/bindgen/src/types/cpp_interface.rs |
Generates scoped constructors that preserve allocation pointers. |
.github/workflows/miri.yml |
Adds provenance and interface-macro checks under both borrow models. |
Review effort: Balanced
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.
Fix optional writable buffers passing pointers derived from shared borrows. Also keep the original allocation pointer when constructing scoped interfaces in bindgen and
#[interface].Add regressions and extend Miri beyond string literals to cover both paths under Stacked Borrows and Tree Borrows.
Fixes #5189.