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

bolts: Fix shmem leak when Drop-ing CommonUnixShMem #1484

Merged
merged 1 commit into from
Aug 29, 2023
Merged

bolts: Fix shmem leak when Drop-ing CommonUnixShMem #1484

merged 1 commit into from
Aug 29, 2023

Conversation

xdqi
Copy link
Contributor

@xdqi xdqi commented Aug 29, 2023

Improved CommonUnixShMem implementation:

In the current implementation, the new function allocates new shared memory using shmctl(IPC_PRIVATE, size, IPC_CREAT) and attaches it to the current process with shmat(id, NULL, 0). However, when it comes time to drop this shared memory, it merely releases the shared memory object with shmctl(id, IPC_RMID, NULL). Unfortunately, this approach leaves the mounted shared memory lingering in the current process's memory space. Even worse, the shared memory won't deallocate from the system until the current process ends.

This pull request addresses this issue by implementing a solution to properly deallocate the shared memory, ensuring that it is no longer present in the process's memory space and is also released from the system resources when no longer needed.

@domenukk
Copy link
Member

Great find, thanks!

@domenukk domenukk merged commit 51e4d81 into AFLplusplus:main Aug 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants