jingfei195887 opened a new pull request, #22497: URL: https://github.com/apache/nuttx/pull/22497
## Summary Skip RAM-map writeback when the mapping was created without PROT_WRITE. This follows the write-permission check already used when unmapping a RAM mapping. The generic msync dispatcher and driver-specific mapping callbacks are unchanged. The separate zero-progress writeback PR #22480 remains independent. ## Impact - Functionality: read-only copied RAM mappings synchronize successfully without seeking or writing the backing file. Writable shared RAM mappings continue to write back normally. - Compatibility: public APIs, configuration, hardware, and build integration are unchanged. Existing file descriptor permissions and private mapping behavior are preserved. - Size: text/data/bss deltas are 32/0/0 bytes in identical small sim configurations with a minimal consumer retaining rammap in the image. The baseline size result is the previously measured 0c45a2fc48b9 / nuttx-apps c621be657e result from the position-restoration review; it was not rebuilt for this PR. ## Testing I confirm that changes are verified on local setup and work as intended: - Build host: Linux x86_64, GCC 13.1.0. Runtime target: sim:nsh with CONFIG_FS_RAMMAP and assertions. Baseline and branch use nuttx-apps c621be657e. - The local bounded driver checks public and internal mapping APIs, O_RDONLY/O_RDWR, MAP_SHARED/MAP_PRIVATE, PROT_NONE/PROT_READ/PROT_READ|PROT_WRITE, and MS_SYNC/MS_ASYNC/MS_SYNC|MS_INVALIDATE. Checks include sync results, seek/write counts, file position, backing data, permission rejection, mapping counts and final close. Testing logs before change (0c45a2fc48b9): ```text MSYNCREADONLY RESULT checks=526 failures=48 ``` Testing logs after change (48ddf63bf8aa): ```text default: MSYNCREADONLY RESULT checks=526 failures=0 large-file/512 KiB FS heap: MSYNCREADONLY RESULT checks=526 failures=0 ``` Full-file and commit checkpatch, Make/CMake, OSTest, and tested-HEAD gate pass. CONFIG_FS_RAMMAP-enabled qemu-armv7r:pnsh protected and qemu-armv8a:knsh kernel builds pass. No hardware runtime, protected/kernel runtime, SMP stress, or allocator-failure injection was performed. ## PR verification Self-Check - [x] This PR introduces only one functional change. - [x] I have updated all required description fields above. - [x] The commit has a component prefix, explanatory body, and my Signed-off-by; code style checks pass. - [ ] My PR is still work in progress (not ready for review). - [x] My PR is ready for review. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
