Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

brk to decrease program's data segment not managed #7

Open
kristopher-pellizzi opened this issue Mar 6, 2022 · 0 comments
Open

brk to decrease program's data segment not managed #7

kristopher-pellizzi opened this issue Mar 6, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@kristopher-pellizzi
Copy link
Owner

On some implementations, the main heap is allocated by using the brk system call.
This type of allocation is correctly managed by MemTrace.
However, besides happening quite rarely, sometimes it is possible that a program uses brk also during a call to free to deallocate memory and therefore reduce program's data segment.

If, after such a call to free, the program allocates memory again using brk and an uninitialized read accesses some location that was previously removed, the reported overlap will be incoherent.
Indeed, MemTrace will add in the access set of the uninitialized read the overlapping writes happened before the use of brk deallocated memory.
But when brk is used to allocate again some memory, it is allocated as filled with 0.

The only way to fix this would be remove all the writes accessing memory beyond the reduced data segment, so that when brk is used to increase it again, the memory it allocates is considered as uninitialized and never written before.

@kristopher-pellizzi kristopher-pellizzi added the bug Something isn't working label Mar 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant