[syslinux:master] bootsect.inc: try to catch obvious .0 problems

syslinux-bot for H. Peter Anvin hpa at zytor.com
Mon Feb 6 12:15:02 PST 2012


Commit-ID:  5780e22f62b5700d3f0b1715148aa791ba364469
Gitweb:     http://www.syslinux.org/commit/5780e22f62b5700d3f0b1715148aa791ba364469
Author:     H. Peter Anvin <hpa at zytor.com>
AuthorDate: Mon, 6 Feb 2012 12:12:26 -0800
Committer:  H. Peter Anvin <hpa at zytor.com>
CommitDate: Mon, 6 Feb 2012 12:12:26 -0800

bootsect.inc: try to catch obvious .0 problems

A typical Linux kernel will be way, way too big for the low memory
bootstrap area, so throw an error message if we end up in the
bootstrap path with something that cannot possibly fit below 640K.

Signed-off-by: H. Peter Anvin <hpa at zytor.com>

---
 core/bootsect.inc |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/core/bootsect.inc b/core/bootsect.inc
index 6c20409..9e47e1a 100644
--- a/core/bootsect.inc
+++ b/core/bootsect.inc
@@ -1,7 +1,7 @@
 ;; -----------------------------------------------------------------------
 ;;
 ;;   Copyright 1994-2009 H. Peter Anvin - All Rights Reserved
-;;   Copyright 2009 Intel Corporation; author: H. Peter Anvin
+;;   Copyright 2009-2012 Intel Corporation; author: H. Peter Anvin
 ;;
 ;;   This program is free software; you can redistribute it and/or modify
 ;;   it under the terms of the GNU General Public License as published by
@@ -38,6 +38,7 @@ SuperSize	equ $+1
 load_bootsec:
 		mov edi,free_high_memory
 		mov [trackbuf+4],edi	; Copy from this address
+		mov eax,0xA0000		; Maximum load
 		xor dx,dx		; No padding
 		mov bx,abort_check	; Don't print dots, but allow abort
 		call load_high
@@ -45,6 +46,9 @@ load_bootsec:
 		sub edi,free_high_memory
 		mov [trackbuf+8],edi	; Save length
 
+		cmp edi,0xA0000-7C00h
+		ja bs_too_big
+
 		mov eax,7C00h		; Entry point
 		mov [trackbuf],eax	; Copy to this address
 
@@ -237,3 +241,13 @@ replace_stub:
 .csip		equ $-4
 
 		section .text16
+bs_too_big:	
+		call close
+		mov si,err_bs_too_big
+		jmp abort_load
+
+		section .data16
+err_bs_too_big	db "Too large for a bootstrap (need LINUX instead of KERNEL?)"
+		db CR, LF, 0
+
+		section .text16


More information about the Syslinux-commits mailing list