Hardening pc-linux Memory Validation via Dynamic /proc/self/maps Discovery#469
Open
Hardening pc-linux Memory Validation via Dynamic /proc/self/maps Discovery#469
Conversation
Add function to initialize memory table from /proc/self/maps.
Removed commented out documentation for ES BSP memory initialization.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Checklist (Please check before submitting)
(Sent before regarding the older version of the fix in the Checksum repo)
Describe the contribution
Mmitigates a root cause of memory related Denial of Service (DoS) vulnerabilities by hardening the
pc-linuxPSP memory validation layer.Previously, the
pc-linuxPSP initialized its memory table with a permissive 0 toSIZE_MAXrange, effectively bypassing all validation and masking potential security risks during development and simulation. This PR replaces that permissive range with a platform native discovery mechanism.Key Changes:
CFE_PSP_InitMemoryTableFromProcMaps(), which parses/proc/self/mapsat startup to identify mapped and accessible memory regions.CFE_PSP_MemValidateRangenow correctly enforces boundaries on Linux, rejecting invalid or unmapped addresses.CFE_PSP_MEM_TABLE_SIZEto 128 to accommodate the fragmented nature of Linux virtual memory maps.Testing performed
pc-linuxPSP to verify total compatibility and correct integration of the new/procdependencies.InitMemoryTableFromProcMapswith console traces to confirm theSysMemoryTableaccurately mirrors the process's real memory map.CFE_PSP_MemalidateRangebehavior by confirming it correctly rejects unmapped addresses (e.g.,0xDEADBEEF) while accepting valid data/stack segments.Expected behavior changes
CFE_PSP_MemValidateRangeon the Linux platform will now correctly return failure (CFE_PSP_INVALID_MEM_ADDR) for non mapped addresses, rather than always returningCFE_PSP_SUCCESS.System(s) tested on
Additional context
Addresses the lack of platform native memory constraints on the
pc-linuxdevelopment platform, providing a security hardened reference for simulation based testing.Fixes:- nasa/cFS#945
Contributor Info