From owner-svn-src-all@FreeBSD.ORG Wed Jun 13 19:04:40 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2B0591065670; Wed, 13 Jun 2012 19:04:40 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 152D28FC08; Wed, 13 Jun 2012 19:04:40 +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 q5DJ4dZn042927; Wed, 13 Jun 2012 19:04:39 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5DJ4dOX042925; Wed, 13 Jun 2012 19:04:39 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201206131904.q5DJ4dOX042925@svn.freebsd.org> From: John Baldwin Date: Wed, 13 Jun 2012 19:04:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237017 - stable/9/lib/libc/stdlib X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 13 Jun 2012 19:04:40 -0000 Author: jhb Date: Wed Jun 13 19:04:39 2012 New Revision: 237017 URL: http://svn.freebsd.org/changeset/base/237017 Log: Ensure that the beginning of the DSS is aligned on a chunk boundary. If the _end symbol used an address with the low bit set, then the initial arena could end up with corrupted rb trees causing a crash during the first call to malloc(). This is a direct commit to stable/9 as it does not affect the version of malloc in HEAD. Reviewed by: jasone MFC after: 1 week Modified: stable/9/lib/libc/stdlib/malloc.c Modified: stable/9/lib/libc/stdlib/malloc.c ============================================================================== --- stable/9/lib/libc/stdlib/malloc.c Wed Jun 13 19:00:29 2012 (r237016) +++ stable/9/lib/libc/stdlib/malloc.c Wed Jun 13 19:04:39 2012 (r237017) @@ -5790,6 +5790,9 @@ MALLOC_OUT: #ifdef MALLOC_DSS malloc_mutex_init(&dss_mtx); dss_base = sbrk(0); + i = (uintptr_t)dss_base & QUANTUM_MASK; + if (i != 0) + dss_base = sbrk(QUANTUM - i); dss_prev = dss_base; dss_max = dss_base; extent_tree_szad_new(&dss_chunks_szad);