Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This release fixes #496
Issue
DNS requests and responses can happen over UDP or TCP. UDP is the most common, but TCP is used often for large responses or by some specific products (we have seen this with Netflix in the past). Handling TCP connections requires more communication with the client and server, so
pihole-FTL
creates TCP helper processes by forking.When dynamically allocated shared memory objects get resized, they get resized, and then re-mapped. The problem is that if our shared memory object is now significantly larger and if this happens on a TCP handler process, the other processes were not notified about the virtual memory change keep using the old shared memory, i.e., they were using dangling pointers. This caused a memory corruption or access error when accessed.
Solution
This pull requests ensures that, when the space of virtual addresses changes, the other forks get notified and can re-map the shared memory objects to get possibly updated virtual memory addresses for their pointers.