DynamoRIO / DynamoRIO/dynamorio

Add a new flag to allow a user to specify the initial heap size for init_emulated_brk().

Open
#7,791 0 comments 0 reactions 1 assignee Claimed by @ivankyluk View on GitHub
Dominant language
C
Stars
3.2k
Forks
629
Avg merge
2d 15h
Merged PRs (30d)
31

Description

The current initial heap size for init_emulated_brk() is 4M. emulate_app_brk() uses mremap to increase or decrease the size as needed.

There are applications, like SPEC 2017 gcc subrun 3 and 4 (uses 1.2G+), which increase the heap size through brk() . When emulate_app_brk() can't increase the size, gcc uses mmap to allocate new memory. This changes the behavior of the application.

Adding a new flag allows for a bigger initial heap size. If the heap size is reduced by the application, there is no guarantee the heap will be able to expand to the initial heap size or beyond.

I've tested an additional change to not shrink the heap size below the initial size to make sure the memory will be available. But gcc subrun 3 returns an internal error if the memory is not shrank when it uses brk to reduce the heap size.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.