tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: SYS_sbrk removal proposal



On 19.12.2017 13:26, Anders Magnusson wrote:
> Den 2017-12-19 kl. 13:12, skrev Sevan Janiyan:
>> Hello,
>>
>> On 12/19/17 11:51, Anders Magnusson wrote:
>>> Sounds good :-)
>>>
>>> Just a note here:
>>>
>>> about 15-20 years ago I did a test by removing the brk(2) syscall and
>>> replacing its use
>>> in malloc() by mmap(), and also add a libc wrapper for brk() that
>>> mmap'ed MAXDSIZ/2 if ever called (as a fallback).
>>>
>>> This approach worked very well for everything tested _except_ emacs.
>>> There were something in emacs dump logic that seemed to expect that
>>> brk() were continuing just above bss, or something.
>>> I didn't go deeper into this back then.
>>>
>>> Anyway, it might be an idea to revisit this.  IMHO it would be really
>>> nice if brk(2) could be declared obsolete :-)
>> Just as a heads up, I believe the FreeBSD folks went through this with
>> their ARMv8 support and looking up the notes on their wiki, indeed,
>> emacs was the fallout.
>> https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=213862
>>
> Last lines are the most interesting:
> 
> Ed Maste freebsd_committer 2017-11-20 21:11:02 UTC
> 
> The GNU bug report claims that it is fixed in 26.1
> 
> So, unless someone want to compile an old emacs, it do not seem like an
> issue anymore :-) -- Ragge
> 
> 

OK, so if we are advancing more quickly. I propose to remove SYS_sbrk
and SYS_ovadvise in one go. (o)vadvuse is not implemented and is a very
old call from the same family as sbrk(2). If I'm not wrong it was never
implemented during the NetBSD lifetime.

Next, we can mark SYS_brk as COMPAT_80 and remove users of it from the
basesystem. Add libc wrapper emulating sbrk() for those who really need it.

Backport emacs patch for older versions in pkgsrc:

https://github.com/emacs-mirror/emacs/commit/918a2dda07ebf16601a93d0464f62c4e846d8b39

Attachment: signature.asc
Description: OpenPGP digital signature



Home | Main Index | Thread Index | Old Index