test the trampoline is inert (zeroed + NX) when dormant
Adds paging.isExecutable and arch.trampolinePage; the smp case now asserts the frame is zeroed and non-executable after bring-up. Teeth-checked against a no-op disarm.
This commit is contained in:
@@ -483,6 +483,20 @@ fn smpTest() void {
|
||||
}
|
||||
log("DANOS-SMP: workers ran on {d} distinct core(s)\n", .{cores_seen});
|
||||
check("tasks ran on multiple cores in parallel", cores_seen >= 2);
|
||||
|
||||
// Bring-up is done, so the trampoline frame must be inert: zeroed (no stale code)
|
||||
// and non-executable (W^X restored). It's armed only while a core is climbing.
|
||||
const tramp = arch.trampolinePage();
|
||||
check("trampoline frame reserved", tramp != 0);
|
||||
if (tramp != 0) {
|
||||
const bytes: [*]const u8 = @ptrFromInt(tramp);
|
||||
var zeroed = true;
|
||||
for (0..4096) |b| {
|
||||
if (bytes[b] != 0) zeroed = false;
|
||||
}
|
||||
check("trampoline page zeroed when dormant", zeroed);
|
||||
check("trampoline page non-executable when dormant", !arch.pageExecutable(tramp));
|
||||
}
|
||||
result();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user