summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhpa <hpa>2005-08-18 21:08:56 +0000
committerhpa <hpa>2005-08-18 21:08:56 +0000
commit8d4a3ad6652e40fbe44cde878c8e0ad0c2c34a94 (patch)
tree24263cd9e6b9af5149df63b5d2a13b9042b2f2e9
parent1deff649355f0cdf02e7b8ffc20560d885004183 (diff)
downloadsyslinux-8d4a3ad6652e40fbe44cde878c8e0ad0c2c34a94.tar.gz
If onerror is set, invoke onerror on escape
-rw-r--r--NEWS1
-rw-r--r--abort.inc75
-rw-r--r--extlinux.asm38
-rw-r--r--isolinux.asm38
-rw-r--r--ldlinux.asm38
-rw-r--r--pxelinux.asm37
-rw-r--r--syslinux.doc2
7 files changed, 85 insertions, 144 deletions
diff --git a/NEWS b/NEWS
index 4c79b138..a19fd686 100644
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,7 @@ Changes in 3.10:
* New API call to do "localboot".
* New API call to query features.
* Fix for bug in EBIOS code discovered by Arwin Vosselman.
+ * NOESCAPE security fix.
Changes in 3.09:
* gcc4 compilation fix.
diff --git a/abort.inc b/abort.inc
new file mode 100644
index 00000000..3c905971
--- /dev/null
+++ b/abort.inc
@@ -0,0 +1,75 @@
+; $Id$
+; -----------------------------------------------------------------------
+;
+; Copyright 2005 H. Peter Anvin - All Rights Reserved
+;
+; 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
+; the Free Software Foundation, Inc., 53 Temple Place Ste 330,
+; Boston MA 02111-1307, USA; either version 2 of the License, or
+; (at your option) any later version; incorporated herein by reference.
+;
+; -----------------------------------------------------------------------
+
+;
+; abort.inc
+;
+; Code to terminate a kernel load
+;
+
+;
+; abort_check: let the user abort with <ESC> or <Ctrl-C>
+;
+abort_load equ abort_check.do_abort
+
+abort_check:
+ call pollchar
+ jz .ret1
+ pusha
+ call getchar
+ cmp al,27 ; <ESC>
+ je .kill
+ cmp al,3 ; <Ctrl-C>
+ jne .ret2
+.kill: mov si,aborted_msg
+
+ ; ... fall through ...
+
+;
+; abort_load: Called by various routines which wants to print a fatal
+; error message and return to the command prompt. Since this
+; may happen at just about any stage of the boot process, assume
+; our state is messed up, and just reset the segment registers
+; and the stack forcibly.
+;
+; SI = offset (in _text) of error message to print
+;
+.do_abort:
+ mov ax,cs ; Restore CS = DS = ES
+ mov ds,ax
+ mov es,ax
+%if IS_SYSLINUX || IS_EXTLINUX
+ mov ss,ax ; Just in case...
+ mov sp,StackBuf-2*3 ; Reset stack
+%elif IS_PXELINUX
+ lss esp,[BaseStack]
+%elif IS_ISOLINUX
+ lss sp,[cs:Stack]
+%else
+ NEED TO KNOW HOW TO RESET STACK
+%endif
+ sti
+ call cwritestr ; Expects SI -> error msg
+
+ ; If onerror is set, jump to onerror, otherwise return
+ ; to the command prompt
+ mov cx,[OnerrorLen]
+ and cx,cx
+ jnz on_error
+ jmp enter_command ; Return to command prompt
+
+;
+; End of abort_check
+;
+.ret2: popa
+.ret1: ret
diff --git a/extlinux.asm b/extlinux.asm
index 73c9f3f0..c7a73810 100644
--- a/extlinux.asm
+++ b/extlinux.asm
@@ -895,43 +895,9 @@ getlinsec_ext:
ret
;
-; abort_check: let the user abort with <ESC> or <Ctrl-C>
+; Abort loading code
;
-abort_check:
- call pollchar
- jz ac_ret1
- pusha
- call getchar
- cmp al,27 ; <ESC>
- je ac_kill
- cmp al,3 ; <Ctrl-C>
- jne ac_ret2
-ac_kill: mov si,aborted_msg
-
-;
-; abort_load: Called by various routines which wants to print a fatal
-; error message and return to the command prompt. Since this
-; may happen at just about any stage of the boot process, assume
-; our state is messed up, and just reset the segment registers
-; and the stack forcibly.
-;
-; SI = offset (in _text) of error message to print
-;
-abort_load:
- mov ax,cs ; Restore CS = DS = ES
- mov ds,ax
- mov es,ax
- cli
- mov sp,StackBuf-2*3 ; Reset stack
- mov ss,ax ; Just in case...
- sti
- call cwritestr ; Expects SI -> error msg
-al_ok: jmp enter_command ; Return to command prompt
-;
-; End of abort_check
-;
-ac_ret2: popa
-ac_ret1: ret
+%include "abort.inc"
;
; allocate_file: Allocate a file structure
diff --git a/isolinux.asm b/isolinux.asm
index cf04243f..50f41174 100644
--- a/isolinux.asm
+++ b/isolinux.asm
@@ -1149,43 +1149,9 @@ local_boot:
jmp kaboom ; If we returned, oh boy...
;
-; abort_check: let the user abort with <ESC> or <Ctrl-C>
+; Abort loading code
;
-abort_check:
- call pollchar
- jz ac_ret1
- pusha
- call getchar
- cmp al,27 ; <ESC>
- je ac_kill
- cmp al,3 ; <Ctrl-C>
- jne ac_ret2
-ac_kill: mov si,aborted_msg
-
-;
-; abort_load: Called by various routines which wants to print a fatal
-; error message and return to the command prompt. Since this
-; may happen at just about any stage of the boot process, assume
-; our state is messed up, and just reset the segment registers
-; and the stack forcibly.
-;
-; SI = offset (in _text) of error message to print
-;
-abort_load:
- mov ax,cs ; Restore CS = DS = ES
- mov ds,ax
- mov es,ax
- cli
- lss sp,[cs:Stack] ; Reset the stack
- sti
- call cwritestr ; Expects SI -> error msg
-al_ok: jmp enter_command ; Return to command prompt
-;
-; End of abort_check
-;
-ac_ret2: popa
-ac_ret1: ret
-
+%include "abort.inc"
;
; searchdir:
diff --git a/ldlinux.asm b/ldlinux.asm
index e415e974..1651ae18 100644
--- a/ldlinux.asm
+++ b/ldlinux.asm
@@ -926,43 +926,9 @@ getfattype:
%include "bootsect.inc"
;
-; abort_check: let the user abort with <ESC> or <Ctrl-C>
+; Abort loading code
;
-abort_check:
- call pollchar
- jz ac_ret1
- pusha
- call getchar
- cmp al,27 ; <ESC>
- je ac_kill
- cmp al,3 ; <Ctrl-C>
- jne ac_ret2
-ac_kill: mov si,aborted_msg
-
-;
-; abort_load: Called by various routines which wants to print a fatal
-; error message and return to the command prompt. Since this
-; may happen at just about any stage of the boot process, assume
-; our state is messed up, and just reset the segment registers
-; and the stack forcibly.
-;
-; SI = offset (in _text) of error message to print
-;
-abort_load:
- mov ax,cs ; Restore CS = DS = ES
- mov ds,ax
- mov es,ax
- cli
- mov sp,StackBuf-2*3 ; Reset stack
- mov ss,ax ; Just in case...
- sti
- call cwritestr ; Expects SI -> error msg
-al_ok: jmp enter_command ; Return to command prompt
-;
-; End of abort_check
-;
-ac_ret2: popa
-ac_ret1: ret
+%include "abort.inc"
;
; allocate_file: Allocate a file structure
diff --git a/pxelinux.asm b/pxelinux.asm
index a48093fc..13bb79b9 100644
--- a/pxelinux.asm
+++ b/pxelinux.asm
@@ -909,42 +909,9 @@ local_boot:
retf ; Return to PXE
;
-; abort_check: let the user abort with <ESC> or <Ctrl-C>
+; Abort loading code
;
-abort_check:
- call pollchar
- jz ac_ret1
- pusha
- call getchar
- cmp al,27 ; <ESC>
- je ac_kill
- cmp al,3 ; <Ctrl-C>
- jne ac_ret2
-ac_kill: mov si,aborted_msg
-
-;
-; abort_load: Called by various routines which wants to print a fatal
-; error message and return to the command prompt. Since this
-; may happen at just about any stage of the boot process, assume
-; our state is messed up, and just reset the segment registers
-; and the stack forcibly.
-;
-; SI = offset (in _text) of error message to print
-;
-abort_load:
- mov ax,cs ; Restore CS = DS = ES
- mov ds,ax
- mov es,ax
- lss esp,[BaseStack]
- sti
- call cwritestr ; Expects SI -> error msg
-al_ok: jmp enter_command ; Return to command prompt
-;
-; End of abort_check
-;
-ac_ret2: popa
-ac_ret1: ret
-
+%include "abort.inc"
;
; kaboom: write a message and bail out. Wait for quite a while,
diff --git a/syslinux.doc b/syslinux.doc
index 4cd6b33b..11c3a25a 100644
--- a/syslinux.doc
+++ b/syslinux.doc
@@ -2,7 +2,7 @@
A suite of bootloaders for Linux
- Copyright (C) 1994-2004 H. Peter Anvin
+ Copyright (C) 1994-2005 H. Peter Anvin
This program is provided under the terms of the GNU General Public
License, version 2 or, at your option, any later version. There is no