:: commit ca94650094c6e599e194f27a73d79c6460abcfb0

mintsuki <mintsuki@protonmail.com> — 2021-12-11 16:55

parents: cf64e8eee1

Revert "stivale2: Add stack validity check"

This reverts commit 4a59ba6ba42840b7ee5a1f4bc13f49750621a299.
diff --git a/stage23/protos/stivale2.c b/stage23/protos/stivale2.c
index 6277185f..164144b6 100644
--- a/stage23/protos/stivale2.c
+++ b/stage23/protos/stivale2.c
@@ -273,25 +273,6 @@ failed_to_load_header_section:
         print("stivale2: WARNING: Requested stack is not 16-byte aligned\n");
     }
 
-    if (stivale2_hdr.stack != 0 && ranges != NULL) {
-        bool stack_valid = false;
-
-        for (size_t i = 0; i < ranges_count; i++) {
-            // Check we have at least 256 bytes of stack available
-            if (stivale2_hdr.stack >= ranges[i].base + 256
-             && stivale2_hdr.stack <= ranges[i].base + ranges[i].length
-             && (ranges[i].permissions & ELF_PF_R)
-             && (ranges[i].permissions & ELF_PF_W)) {
-                stack_valid = true;
-                break;
-            }
-        }
-
-        if (!stack_valid) {
-            panic("stivale2: The provided stack is not valid");
-        }
-    }
-
     // It also says the stack cannot be NULL for 32-bit kernels
     if (bits == 32 && stivale2_hdr.stack == 0) {
         panic("stivale2: The stack cannot be 0 for 32-bit kernels");
tab: 248 wrap: offon