[syslinux] Proposed fix: syslinux

Luiz Carlos Ramos lramos.prof at yahoo.com.br
Fri Sep 29 15:57:04 PDT 2023


Hello,

my name is Luiz Ramos. I work in Brazil and causually had to pay
attention to some bits of the Syslinux project, ultimately having found
what I think it's a bug.

The problem shows itself as an inability of the loaded Linux kernel
to access all the memory the machine has. This is due to the fact that
there is an issue in the exit_boot() routine, that prevents it from
searching for memory chunks above id 128 (i.e., E820MAX).

Below I propose a patch which hopefully solves the problem (or at least,
solved my case):

=== patch ============================================================
diff --git a/efi/main.c b/efi/main.c
index 6a748412..ce8f21ec 100644
--- a/efi/main.c
+++ b/efi/main.c
@@ -1034,7 +1034,7 @@ static int exit_boot(struct boot_params *bp)
 	 * interim.
 	 */
 	e = e820buf = bp->e820_map;
-	for (i = 0; i < nr_entries && i < E820MAX; i++) {
+	for (i = 0; i < nr_entries; i++) {
 		struct e820_entry *prev = NULL;
 
 		if (e > e820buf)
@@ -1083,8 +1083,11 @@ static int exit_boot(struct boot_params *bp)
 		if (prev && (prev->start + prev->len) == e->start &&
 		    prev->type == e->type)
 			prev->len += e->len;
-		else
+		else {
 			e++;
+			if (e > &e820_type[E820MAX-1])
+				break;
+		}
 	}
 
 	bp->e820_entries = e - e820buf;
=== patch ============================================================

Hope it may help,
Luiz Carlos Ramos
lramos.prof at yahoo.com.br



More information about the Syslinux mailing list