From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs,gmane.os.freebsd.devel.hackers Subject: bug#24892: {s, }brk removed from FreeBSD 11.x and later, arm64 architecture Date: Sat, 19 Nov 2016 08:57:44 +0200 Message-ID: <83vavkardj.fsf@gnu.org> References: <82a03552-8f33-2dbe-6bb5-54f649b29db7@cs.ucla.edu> <86vavxs2cn.fsf@members.fsf.org> <5adee8d9-8f08-9536-a95f-ae64719d6a0f@cs.ucla.edu> <40f8df50-b431-1ebd-221c-df2aa453aa81@cs.ucla.edu> <06ee71fd-1a64-d32b-862e-c725807aef4e@cs.ucla.edu> <876cf047-82fb-f08c-bbb3-024206f6fabd@cs.ucla.edu> <83twb6dnkm.fsf@gnu.org> <8637ipm0nb.fsf@lostca.se> <5ec481c4-41e1-c7dd-433d-f533653b132f@cs.ucla.edu> <1dc6fa8c-7378-6e4e-1d9e-86c962fc48bb@cs.ucla.edu> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1479538698 2228 195.159.176.226 (19 Nov 2016 06:58:18 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 19 Nov 2016 06:58:18 +0000 (UTC) Cc: freebsd-hackers@freebsd.org, brooks@freebsd.org, emaste@freebsd.org, ashish.is@lostca.se, 24892@debbugs.gnu.org To: Paul Eggert Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Nov 19 07:58:12 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c7zbH-0007w8-Go for geb-bug-gnu-emacs@m.gmane.org; Sat, 19 Nov 2016 07:58:11 +0100 Original-Received: from localhost ([::1]:40284 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c7zbL-0005DM-0X for geb-bug-gnu-emacs@m.gmane.org; Sat, 19 Nov 2016 01:58:15 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56569) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c7zb9-0005BE-PB for bug-gnu-emacs@gnu.org; Sat, 19 Nov 2016 01:58:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c7zb8-0002h4-SZ for bug-gnu-emacs@gnu.org; Sat, 19 Nov 2016 01:58:03 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:47197) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1c7zb8-0002gu-PT for bug-gnu-emacs@gnu.org; Sat, 19 Nov 2016 01:58:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1c7zb8-00056n-Im; Sat, 19 Nov 2016 01:58:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 19 Nov 2016 06:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24892 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 24892-submit@debbugs.gnu.org id=B24892.147953867719622 (code B ref 24892); Sat, 19 Nov 2016 06:58:02 +0000 Original-Received: (at 24892) by debbugs.gnu.org; 19 Nov 2016 06:57:57 +0000 Original-Received: from localhost ([127.0.0.1]:34363 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c7zb3-00056Q-18 for submit@debbugs.gnu.org; Sat, 19 Nov 2016 01:57:57 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:37263) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c7zb0-000569-J2 for 24892@debbugs.gnu.org; Sat, 19 Nov 2016 01:57:55 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c7zau-0002dQ-CB for 24892@debbugs.gnu.org; Sat, 19 Nov 2016 01:57:49 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:36636) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c7zam-0002bY-5x; Sat, 19 Nov 2016 01:57:40 -0500 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:3339 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1c7zal-0003x0-6z; Sat, 19 Nov 2016 01:57:39 -0500 In-reply-to: <1dc6fa8c-7378-6e4e-1d9e-86c962fc48bb@cs.ucla.edu> (message from Paul Eggert on Fri, 18 Nov 2016 14:22:07 -0800) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:125855 gmane.os.freebsd.devel.hackers:58202 Archived-At: > From: Paul Eggert > Date: Fri, 18 Nov 2016 14:22:07 -0800 > Cc: freebsd-hackers@freebsd.org, Brooks Davis , > 24892@debbugs.gnu.org, Ashish SHUKLA > > > it seems there's an implementation that allocates memory out of a large array in .bss used for some platforms - could we make use of that here? > > Quite possibly. Unfortunately the code that uses that array (in gmalloc.c) also > uses sbrk to move the break past the end of the large array. The large array is > intended for use only during the build process; during ordinary execution, sbrk > is used. > > Perhaps Emacs could work around the problem by supplying a user-space sbrk > emulator, which uses mmap to support the old-fashioned model where the heap is > contiguous. Is that something that could be done easily? That is, is there some > way to reserve the address space for a potentially-large Emacs heap right after > .bss, such that library calls to malloc and mmap won't use this address space? > That might do the trick. > > Brooks Davis wrote: > > What does emacs actually need from sbrk()? Could it get by with something with the same interface allocating from .bss or does it need its allocations to be at the end of .bss? > > I think more the latter. The problem with a fixed-size .bss is that whatever > size we pick during the build is likely to be wrong for users. Also, Emacs saves > the entire build-time .bss into an executable, so an enormous .bss will be > counterproductive. I agree with everything Paul wrote. There's one other factor you should be aware of: Emacs 25.2 will most probably start its pretest in a week or so. If this problem can be solved for FreeBSD on arm64 by providing a drop-in replacement for sbrk, we could include that in 25.2, which is a strictly bug-fix release that can only accept safe bug fixes. If not, the solution will have to wait for Emacs 26.1, currently being developed on the master branch, which is unlikely to be released before mid-2017 or even the end of 2017. Not a catastrophe, given that Emacs never worked on this host, but something to consider. (It is, of course, possible to provide a simple and safe solution for 25.2 and a more elaborate one for 26.1.) Thanks.