sbpf, vm: read program text with FD_LOAD #11149
All Vouch review confidence checks passed
Residual risk 0.24 = Change Risk (0.43) × (1 − Review Confidence (0.45)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.43 · 185 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Shallow Review Depth
shallow_review_depth
0.344
Diff Size
diff_size
0.313
Real PR Conversation Timeline
1 comments
"Review active on #11149"
general
weight: 0.35
valentynkit
Addresses #10341.
On the lenient path a program's text section can land at an odd address, making every instruction read a misaligned load. As far as I can tell Agave accepts and runs such programs, since it reads instructions byte by byte and never checks alignment (https://github.com/anza-xyz/sbpf/blob/v0.14.4/src/ebpf.rs#L675-L684), so rejecting them on our side would diverge. Instead this reads the text words through
FD_LOAD, which compiles down to the exact same load as before, so the interpreter doesn't pay for it.One thing I left alone: the text pointer itself is still typed as if it were aligned, which strictly speaking is still UB even with nothing reading through it. Cleaning that up means retyping the field and touching a bunch of signatures, and that felt too big for a first PR here. Happy to do the wider version instead if that's preferred.
The tests guard the parity, not the UB: a program with oddly placed text has to keep loading and validating exactly like an aligned one, so a well-meaning alignment check can't slip in later. The UB itself they can't catch, since the sanitizer report doesn't fail the build and x86 shrugs the load off, so the ubsan job going quiet is the only visible change there.
I ran the loader and VM unit tests under both gcc and clang with ubsan: the misaligned-load report shows up without the fix and is gone with it. The workspace-backed tests wouldn't run in my environment, so those ride on CI.