This repository was archived by the owner on Jan 22, 2025. It is now read-only.
Audit types used by VM due to rust 1.68 memory layout changes #29852
Labels
runtime
Issues related to runtime, BPF, and LLVM
Problem
Rust 1.68 has changed memory layout of certain types, which impacts
Vec
and other types within the codebase. This is an issue for any types that are used within the VM where its memory layout is assumed.This was discovered when upgrading Rust to 1.66.0, which also upgraded
nightly
to 1.68. Thecheck_type_assumptions
test failed due to the layout ofInstruction
andAccountInfo
changing.solana/sdk/program/src/program.rs
Lines 394 to 545 in aef1a43
For types that are used that assume a certain layout, we may need to create our own stable-layout versions of those types. Here's an example for
Vec
:https://godbolt.org/z/v4qa9vGYz
I noticed at least a few types in the VM do this already with types prefixed by
Sol
, i.e.SolInstruction
,SolAccountMeta
, andSolAccountInfo
:solana/programs/bpf_loader/src/syscalls/cpi.rs
Lines 390 to 425 in aef1a43
Proposed Solution
Audit types used by the VM that may assume layout (
Instruction
,AccountInfo
,AccountMeta
, etc) and see if any require a stable layout. Nail down those layouts and update thecheck_type_assumptions
test.The text was updated successfully, but these errors were encountered: