Fix CVE-2017-5669: shm shmat mmap nil-page protection #114
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.
Background
In ipc/shm.c, do_shmat() can call mmap with MAP_FIXED to address 0 when attaching a shared memory segment, but the nil-page (addr == 0) is not properly protected; this can lead to incorrect memory mappings and potential local denial-of-service or security policy bypass (CVE-2017-5669).:contentReference[oaicite:1]{index=1}
Changes
Harden shmat() by adjusting address rounding and nil-page handling so that mappings to address 0 respect nil-page protection and do not result in an unsafe MAP_FIXED nil mapping.:contentReference[oaicite:2]{index=2}
Security Impact
Prevents local processes from exploiting the shared memory attach path to map nil-page under unsafe conditions, addressing CVE-2017-5669.:contentReference[oaicite:3]{index=3}
References
Upstream commit: e1d35d4dc7f089e6c9c080d556feedf9c706f0c7; CVE: CVE-2017-5669