NetBSD-Bugs archive

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

lib/52842: Obsolete brk(2)/sbrk(2)



>Number:         52842
>Category:       lib
>Synopsis:       Obsolete brk(2)/sbrk(2)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    lib-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Tue Dec 19 23:15:00 +0000 2017
>Originator:     Kamil Rytarowski
>Release:        NetBSD 8.99.9 amd64
>Organization:
TNF
>Environment:
NetBSD chieftec 8.99.9 NetBSD 8.99.9 (GENERIC) #2: Sun Dec 10 06:11:20 CET 2017  root@chieftec:/public/netbsd-root/sys/arch/amd64/compile/GENERIC amd64
>Description:
The sbrk(2) and brk(2) calls have been obsoleted by mmap(2).

sbrk(2) users:
 - gpl2/libmalloc
 - LLVM (Process::GetMallocUsage())
 - am-utils (debug)
 - unbound (debug)
 - binutils / nm (debug)
 - binutils / gas (debug)
 - binutils / ld (debug)
 - binutils / libiberty (debug)
 - gcc / libiberty (debug)
 - gdb
 - lib/libbsdmalloc
 - lib/libc/gmon/gmon.c
 - lib/libc/stdlib/jemalloc.c (USE_BRK)
 - lib/libc/stdlib/malloc.c
 - tests/lib/libc/gen/t_dir.c (hack for hand-made leak-detector)
 - tests/lib/libc/sys/t_mlock.c (sbrk(0))

brk(2) users:
 - lib/libc/stdlib/malloc.c


sbrk(2) is mostly used for debugging purposes, to find out the end of
heap ("sbrk(0)").

libc/gmon should be switched away from sbrk(2).

There is a need for improved debugging facilities to introspect the
jemalloc(3) internals, something comparable to mallinfo from <malloc.h>
in GNU.
>How-To-Repeat:
grep -r brk /usr/src
>Fix:
N/A



Home | Main Index | Thread Index | Old Index