svn commit: r242145 - head/sys/boot/common

Alexander Motin mav at FreeBSD.org
Fri Oct 26 16:32:21 UTC 2012


Author: mav
Date: Fri Oct 26 16:32:20 2012
New Revision: 242145
URL: http://svn.freebsd.org/changeset/base/242145

Log:
  Fix loader crash when some unhalted exception happens during `include`
  command execution.  In case of such unhandled exception, vmReset() inside
  ficlExecC() flushes the VM state.  Attempt to return back to Forth after
  that cause garbage dereference with unexpected results.  To avoid that
  situation call vmThrow() directly instead of expecting Forth to do it.

Modified:
  head/sys/boot/common/interp_forth.c

Modified: head/sys/boot/common/interp_forth.c
==============================================================================
--- head/sys/boot/common/interp_forth.c	Fri Oct 26 16:31:12 2012	(r242144)
+++ head/sys/boot/common/interp_forth.c	Fri Oct 26 16:32:20 2012	(r242145)
@@ -132,6 +132,12 @@ bf_command(FICL_VM *vm)
 	result=BF_PARSE;
     }
     free(line);
+    /*
+     * If there was error during nested ficlExec(), we may no longer have
+     * valid environment to return.  Throw all exceptions from here.
+     */
+    if (result != 0)
+	vmThrow(vm, result);
     /* This is going to be thrown!!! */
     stackPushINT(vm->pStack,result);
 }


More information about the svn-src-all mailing list