If onerror is set, invoke onerror on escape
authorhpa <hpa>
Thu, 18 Aug 2005 21:08:56 +0000 (21:08 +0000)
committerhpa <hpa>
Thu, 18 Aug 2005 21:08:56 +0000 (21:08 +0000)
NEWS
abort.inc [new file with mode: 0644]
extlinux.asm
isolinux.asm
ldlinux.asm
pxelinux.asm
syslinux.doc

diff --git a/NEWS b/NEWS
index 4c79b13..a19fd68 100644 (file)
--- 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 (file)
index 0000000..3c90597
--- /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
index 73c9f3f..c7a7381 100644 (file)
@@ -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
index cf04243..50f4117 100644 (file)
@@ -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:
index e415e97..1651ae1 100644 (file)
@@ -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
index a48093f..13bb79b 100644 (file)
@@ -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,
index 4cd6b33..11c3a25 100644 (file)
@@ -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