:: commit 254c90928be16e837615a5d37cfd8eabba29112c

Mintsuki <mintsuki@protonmail.com> — 2026-02-07 08:42

parents: c53ca715f9

protos/multiboot2: Validate architecture field in header

diff --git a/common/protos/multiboot2.c b/common/protos/multiboot2.c
index 63a551ea..b1d54d05 100644
--- a/common/protos/multiboot2.c
+++ b/common/protos/multiboot2.c
@@ -118,6 +118,10 @@ noreturn void multiboot2_load(char *config, char* cmdline) {
         panic(true, "multiboot2: Header checksum is invalid");
     }
 
+    if (header->architecture != MULTIBOOT_ARCHITECTURE_I386) {
+        panic(true, "multiboot2: Unsupported architecture %u (expected i386)", header->architecture);
+    }
+
     size_t header_offset_in_file = (uintptr_t)header - (uintptr_t)kernel;
     if (header->header_length > kernel_file_size - header_offset_in_file) {
         panic(true, "multiboot2: Header length exceeds kernel file size");
tab: 248 wrap: offon