P2.5: put user data below user code so sysretq loads the right SS #147
All Vouch review confidence checks passed
Residual risk 0.17 = Change Risk (0.39) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.39 · 259 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 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
Diff Size
diff_size
0.333
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #147"
general
weight: 0.35
garrickdabbs
The GDT put user code (
0x2B) before user data (0x33).sysretqloadsSS = STAR[63:48] + 8andCS = STAR[63:48] + 16, so SS became0x23, which is the upper half of the TSS descriptor. Nothing executessysretqyet, so the bug is latent. Once ring 3 runs, the firstiretqback to it would take#GP. This blocks P2.5 (#60).GDT layout
0x08, kdata0x10, TSS0x18/0x20, udata0x2B, ucode0x33. STAR's sysret base is0x23, sosysretqloads SS0x2Band CS0x33.Selectors::user_data: the field is used now, so its#[allow(dead_code)]is gone.syscall::initx86_64'sStar::write, which checks both 8-byte offsets and the privilege levels. If the layout is wrong, the kernel panics at boot instead of faulting on the first return to ring 3:syscall::initno longer has anunsafeblock; CR4 setup keeps its own. The rawIA32_andRFLAGS_DFconstants are removed.Tests (
kernel/src/test.rs)star_matches_gdt_layout_for_sysret: checksuser_data + 8 == user_codeandcode + 8 == data, and thatStar::read()decodes back to the GDT selectors. With the old descriptor order restored, boot panics withSysretOffset.syscall_entry_msrs_are_programmed: checks that LSTAR points into the higher half and that SFMASK is exactly IF | DF.Docs
CHANGELOG.md: new Fixed* entry.docs/PLAN.md: #140 is no longer listed as blocking the P2.5 row in §8 or under open bugs in §11. The P2.5 row now also notes that EFER.SCE is never set, which is still open P2.5 work and not touched here.task: P2.5