From 7fd29c9cbe1e611927a2a4f27f94d011851dc3a3 Mon Sep 17 00:00:00 2001 From: Philipp Oppermann Date: Fri, 25 Jan 2019 13:55:42 +0100 Subject: [PATCH] Trigger a double fault through a stack overflow -> triple fault --- src/main.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main.rs b/src/main.rs index 5d9cfc90..54a09190 100644 --- a/src/main.rs +++ b/src/main.rs @@ -12,10 +12,12 @@ pub extern "C" fn _start() -> ! { blog_os::interrupts::init_idt(); - // trigger a page fault - unsafe { - *(0xdeadbeef as *mut u64) = 42; - }; + fn stack_overflow() { + stack_overflow(); // for each recursion, the return address is pushed + } + + // trigger a stack overflow + stack_overflow(); println!("It did not crash!"); loop {}