This patch implements the program break and the related functions brk() and sbrk() and the corresponding syscall. The program counter implementation is necessary to support statically linked executables as well as applications launched by the Linux dynamic linker (aka ld-linux-x86-64.so.2) on OSv.
Please note that both the functions and the syscall are considered legacy API however we need to support it for the reasons stated above. Glibc and some memory allocators like jemalloc use brk for some type of memory allocations.
In essence, the program break implementation is based on mmap(). For details please look into the relevant code comments.
This patch also adds a new unit test to verify if the program break works correctly.
This is one of the very first patches of the series implementing the missing functionality to support statically linked executables as well as applications launched by the Linux dynamic linker.
This patch implements the program break and the related functions
brk()
andsbrk()
and the corresponding syscall. The program counter implementation is necessary to support statically linked executables as well as applications launched by the Linux dynamic linker (akald-linux-x86-64.so.2
) on OSv.Please note that both the functions and the syscall are considered legacy API however we need to support it for the reasons stated above. Glibc and some memory allocators like jemalloc use
brk
for some type of memory allocations.In essence, the program break implementation is based on
mmap()
. For details please look into the relevant code comments.This patch also adds a new unit test to verify if the program break works correctly.
This is one of the very first patches of the series implementing the missing functionality to support statically linked executables as well as applications launched by the Linux dynamic linker.
Fixes #1138