Date: Fri, 26 Oct 2012 16:32:21 +0000 (UTC) From: Alexander Motin <mav@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r242145 - head/sys/boot/common Message-ID: <201210261632.q9QGWLuO040348@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201210261632.q9QGWLuO040348>