diff --git a/osdk/src/commands/build/mod.rs b/osdk/src/commands/build/mod.rs index 7f680b214..2a3176be0 100644 --- a/osdk/src/commands/build/mod.rs +++ b/osdk/src/commands/build/mod.rs @@ -213,6 +213,11 @@ fn build_kernel_elf( // This is to let rustc know that "cfg(ktest)" is our well-known configuration. // See the [Rust Blog](https://blog.rust-lang.org/2024/05/06/check-cfg.html) for details. "--check-cfg cfg(ktest)", + // The red zone is a small area below the stack pointer for optimization, primarily in + // user-space applications. This optimization can be problematic in the kernel, as the CPU + // or exception handlers may overwrite kernel data in the red zone. Therefore, we disable + // this optimization. + "-C no-redzone=y", ]); if matches!(arch, Arch::X86_64) {