:: commit 0ada1840dcd98f193492ad3d551e3a0cb09ee750

Mintsuki <mintsuki@protonmail.com> — 2025-09-15 17:58

parents: 34b6e29fe7

protos/limine: Default to KASLR=no

diff --git a/CONFIG.md b/CONFIG.md
index b70e33fb..0a22ef62 100644
--- a/CONFIG.md
+++ b/CONFIG.md
@@ -229,8 +229,8 @@ Editor control options:
   * `resolution` - The resolution to be used. This setting takes the form of
     `<width>x<height>x<bpp>`. If the resolution is not available, Limine will
     pick another one automatically. Omitting `<bpp>` will default to 32.
-  * `kaslr` - For relocatable executables, if set to `no`, disable kernel
-    address space layout randomisation. KASLR is enabled by default.
+  * `kaslr` - For relocatable executables, if set to `yes`, enable kernel
+    address space layout randomisation. KASLR is disabled by default.
   * `randomise_hhdm_base` - If set to `yes`, randomise the base address of the
     higher half direct map. If set to `no`, do not. By default it is `yes` if
     KASLR is supported and enabled, else it is `no`.
diff --git a/common/protos/limine.c b/common/protos/limine.c
index 7b6352de..b606f6ec 100644
--- a/common/protos/limine.c
+++ b/common/protos/limine.c
@@ -458,9 +458,10 @@ noreturn void limine_load(char *config, char *cmdline) {
     uint8_t *kernel = freadall(kernel_file, MEMMAP_BOOTLOADER_RECLAIMABLE);
 
     char *kaslr_s = config_get_value(config, 0, "KASLR");
-    bool kaslr = true;
-    if (kaslr_s != NULL && strcmp(kaslr_s, "no") == 0)
-        kaslr = false;
+    bool kaslr = false;
+    if (kaslr_s != NULL && strcmp(kaslr_s, "yes") == 0) {
+        kaslr = true;
+    }
 
     // ELF loading
     uint64_t entry_point = 0;
@@ -845,7 +846,7 @@ FEAT_START
     if (randomise_hhdm_base_s == NULL) {
         randomise_hhdm_base = kaslr;
     } else {
-        randomise_hhdm_base = strcasecmp(randomise_hhdm_base_s, "no") != 0;
+        randomise_hhdm_base = strcasecmp(randomise_hhdm_base_s, "yes") == 0;
     }
 
     set_paging_mode(randomise_hhdm_base);
diff --git a/test/limine.conf b/test/limine.conf
index 4f263370..cc66f8ee 100644
--- a/test/limine.conf
+++ b/test/limine.conf
@@ -13,7 +13,6 @@ backdrop: 008080
     comment: Test of the Limine boot protocol. ${ARCH} ${FW_TYPE}
 
     protocol: limine
-    kaslr: no
     path: ${TEST_KERNEL}
     cmdline: This is an example command line.
 
tab: 248 wrap: offon