From owner-svn-src-head@FreeBSD.ORG Fri Oct 26 16:32:21 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 736D1D28; Fri, 26 Oct 2012 16:32:21 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5984F8FC14; Fri, 26 Oct 2012 16:32:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9QGWL1w040351; Fri, 26 Oct 2012 16:32:21 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9QGWLuO040348; Fri, 26 Oct 2012 16:32:21 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201210261632.q9QGWLuO040348@svn.freebsd.org> From: Alexander Motin Date: Fri, 26 Oct 2012 16:32:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r242145 - head/sys/boot/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Oct 2012 16:32:21 -0000 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); }