summaryrefslogtreecommitdiffstats
path: root/sys/boot/common
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2012-10-26 16:32:20 +0000
committermav <mav@FreeBSD.org>2012-10-26 16:32:20 +0000
commite57dfaa1b0a1043392cc1b09e2e4c5253fcc62f0 (patch)
tree123ef21084ede9a35a2ba535056aaa32e7f51aec /sys/boot/common
parent988b7ac3956d4a78263203e16f1dc43c57f573bf (diff)
downloadFreeBSD-src-e57dfaa1b0a1043392cc1b09e2e4c5253fcc62f0.zip
FreeBSD-src-e57dfaa1b0a1043392cc1b09e2e4c5253fcc62f0.tar.gz
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.
Diffstat (limited to 'sys/boot/common')
-rw-r--r--sys/boot/common/interp_forth.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/boot/common/interp_forth.c b/sys/boot/common/interp_forth.c
index cc66c4d..b53da43 100644
--- a/sys/boot/common/interp_forth.c
+++ b/sys/boot/common/interp_forth.c
@@ -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);
}
OpenPOWER on IntegriCloud