From owner-svn-src-all@FreeBSD.ORG Tue Feb 19 23:46:52 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 4A45C66C; Tue, 19 Feb 2013 23:46:52 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 3D0DD176; Tue, 19 Feb 2013 23:46:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1JNkp5X036040; Tue, 19 Feb 2013 23:46:51 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1JNkpnP036039; Tue, 19 Feb 2013 23:46:51 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201302192346.r1JNkpnP036039@svn.freebsd.org> From: Jilles Tjoelker Date: Tue, 19 Feb 2013 23:46:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247013 - head/bin/sh X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Feb 2013 23:46:52 -0000 Author: jilles Date: Tue Feb 19 23:46:51 2013 New Revision: 247013 URL: http://svnweb.freebsd.org/changeset/base/247013 Log: sh: Fix a crash with the stackmark code. If a stack mark is set while the current stack block is empty, the stack block may move later on (because of realloc()) and the stack mark needs to be updated. This updating does not happen after popstackmark() has been called; therefore, call setstackmark() again if the stack mark is still being used. For some reason, this only affects a few users. I cannot reproduce it. The situation seems quite rare as well because an empty stack block would usually be freed (by popstackmark()) before execution reaches a setstackmark() call. PR: 175922 Tested by: KT Sin Modified: head/bin/sh/eval.c Modified: head/bin/sh/eval.c ============================================================================== --- head/bin/sh/eval.c Tue Feb 19 21:35:17 2013 (r247012) +++ head/bin/sh/eval.c Tue Feb 19 23:46:51 2013 (r247013) @@ -174,6 +174,7 @@ evalstring(char *s, int flags) any = 1; } popstackmark(&smark); + setstackmark(&smark); } popfile(); popstackmark(&smark); @@ -296,6 +297,7 @@ evaltree(union node *n, int flags) } n = next; popstackmark(&smark); + setstackmark(&smark); } while (n != NULL); out: popstackmark(&smark);