-
Notifications
You must be signed in to change notification settings - Fork 3.9k
[compiler][vm] add visibility modifier to structs/enums: step 3 #18117
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
base: main
Are you sure you want to change the base?
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
7f7d90f to
eac9a1d
Compare
60805ed to
e7724b0
Compare
eac9a1d to
b720555
Compare
6eb2d64 to
e1a1542
Compare
f96cb3a to
ca5c372
Compare
e1a1542 to
effba77
Compare
ca5c372 to
44b76a4
Compare
effba77 to
c550c6e
Compare
0c3accf to
caa8cd8
Compare
c550c6e to
97454dc
Compare
2de180d to
b0ec601
Compare
97454dc to
45a6adb
Compare
b0ec601 to
d20a6b1
Compare
45a6adb to
127020a
Compare
e040fa8 to
d554746
Compare
127020a to
a1a9b28
Compare
d554746 to
bc41710
Compare
b855709 to
394fb58
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
| return Ok(true); | ||
| } | ||
| } | ||
| Ok(false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reference safety bypass lacks wellformedness validation for attributes
Medium Severity
handle_borrow_field_mutable bypasses the normal call reference safety analysis (which checks CALL_BORROWED_MUTABLE_REFERENCE_ERROR) based solely on the presence of a BorrowFieldMutable attribute, without any bytecode verifier pass validating that the attribute is correctly placed. A crafted module could attach BorrowFieldMutable to an arbitrary function to bypass mutable reference safety checks, potentially enabling aliased mutable references. The TODO for the wellformedness check needs to land before or atomically with this change.
Additional Locations (1)
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
394fb58 to
80b711e
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
80b711e to
b5ecc41
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
b5ecc41 to
6bc992e
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ Forge suite
|
✅ Forge suite
|
✅ Forge suite
|



Description
This PR:
TODO: adds wellformedness check for struct apis to bytecode verifier;
close #18199
How Has This Been Tested?
update of existing test cases for struct APIs.
Key Areas to Review
Type of Change
Which Components or Systems Does This Change Impact?
Checklist
Note
High Risk
Touches Move bytecode format (new function-attribute encodings + version gating) and alters reference-safety verification behavior for mutable borrow-field wrappers, which are correctness- and safety-critical paths.
Overview
Adds new
FunctionAttributevariants (pack/unpack/test_variantplus variant- and field-offset forms, includingBorrowField*) and extends bytecode serialization/deserialization to encode/decode them, gated toVERSION_10with clearer malformed/version error messages.Updates compiler v2 bytecode generation to attach these attributes to generated struct/enum API wrappers and adjusts compatibility checks to treat these attributes as non-removable.
Modifies reference-safety verification to special-case calls to functions marked
BorrowFieldMutable(treating them as direct field-borrow effects) and updates/extends serializer tests and.expfixtures to reflect the new attributes and the now-successful cross-module borrow-field scenario.Written by Cursor Bugbot for commit 6bc992e. This will update automatically on new commits. Configure here.