fix: stacks at top of user VA in own 1 MiB band (guard, heap kept below), 8/16 pages default; kernel fault msg names pid, kind, flags stack overflow; flaky OVERFLOW + spawntest/test-qemu check it
This commit is contained in:
@@ -16,6 +16,16 @@ pub mod op {
|
||||
pub const CRASH: usize = 2;
|
||||
/// Blocks for good inside the handler.
|
||||
pub const HANG: usize = 3;
|
||||
/// Recurses until its stack runs out: the kernel says it overflowed.
|
||||
pub const OVERFLOW: usize = 4;
|
||||
}
|
||||
|
||||
/// Ever deeper, a KiB of stack a call, until there is none.
|
||||
#[allow(unconditional_recursion, reason = "running off the stack is what it is for")]
|
||||
fn deeper(n: usize) -> usize {
|
||||
let frame = core::hint::black_box([n as u8; 1024]);
|
||||
// Used after the call, so the call is not a jump.
|
||||
deeper(n + 1) + frame[n % 1024] as usize
|
||||
}
|
||||
|
||||
/// Everything goes through `handle_call`.
|
||||
@@ -49,6 +59,9 @@ impl Server for Flaky {
|
||||
match words[0] {
|
||||
op::WHO => {}
|
||||
op::CRASH => panic!("asked to crash"),
|
||||
op::OVERFLOW => {
|
||||
core::hint::black_box(deeper(0));
|
||||
}
|
||||
op::HANG => {
|
||||
// A notification nobody signals.
|
||||
if let Ok(never) = syscall::create_notification() {
|
||||
|
||||
Reference in New Issue
Block a user