[syslinux] [PATCH 2/3] Fix initrd overwriting the kernel for some kernel sizes

Sergey Vlasov vsu at altlinux.ru
Tue Jul 22 02:46:08 PDT 2008


The address in EDI returned by the load_high call used to load the
kernel needs to be passed to parse_load_initrd, but the code which
clears memory after setup sectors for 1.2.x kernels was corrupting
low 16 bits of EDI.  In most cases this corruption was not noticed,
because with usual setup sizes DI was set to 0xf800, therefore the
chance of getting the kernel size such that initrd would actually
overwrite the kernel was about 3%.

Signed-off-by: Sergey Vlasov <vsu at altlinux.ru>
---
 core/runkernel.inc |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/core/runkernel.inc b/core/runkernel.inc
index c7af6cc..5748b0b 100644
--- a/core/runkernel.inc
+++ b/core/runkernel.inc
@@ -270,6 +270,7 @@ high_load_done:
 ; if they see protected-mode kernel data after the setup sectors, so
 ; clear that memory.
 ;
+		push di
 		mov di,[SetupSecs]
 		shl di,9
 		xor eax,eax
@@ -277,6 +278,7 @@ high_load_done:
 		sub cx,di
 		shr cx,2
 		rep stosd
+		pop di
 
 ;
 ; Now see if we have an initial RAMdisk; if so, do requisite computation
-- 
1.5.6.2.305.g2938b




More information about the Syslinux mailing list