You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "casaroli (via GitHub)" <gi...@apache.org> on 2026/10/17 17:18:43 UTC
[PR] fs/mmap: Write a shared mapping back to the file on munmap(). [nuttx]
casaroli opened a new pull request, #20726:
URL: https://github.com/apache/nuttx/pull/20726
## Summary
With `CONFIG_FS_RAMMAP`, `mmap()` of a file on a file system without its own mmap copies the file into memory. `munmap()` freed that copy without writing it back, so changes made through a `MAP_SHARED`, `PROT_WRITE` mapping were lost, while POSIX says they reach the file. `msync()` wrote them, but programs that map a file, change it and unmap it do not call `msync()`.
`munmap()` of a shared, writable mapping now writes the unmapped range back to the file first. Private mappings are not written.
## Impact
`CONFIG_FS_RAMMAP` only.
## Testing
Builds: `qemu-armv8a:nsh`, `qemu-armv8a:knsh`, `lm3s6965-ek:qemu-flat`.
`tools/checkpatch.sh -c -u -m -g` passes.
On `qemu-armv8a:knsh` with `CONFIG_FS_RAMMAP`: a program that maps a file `MAP_SHARED`, writes it through the mapping and unmaps it left the file unchanged before; with the change the file has the new data.
--
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: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fs/mmap: Write a shared mapping back to the file on munmap(). [nuttx]
Posted by "acassis (via GitHub)" <gi...@apache.org>.
acassis merged PR #20726:
URL: https://github.com/apache/nuttx/pull/20726
--
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: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fs/mmap: Write a shared mapping back to the file on munmap(). [nuttx]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #20726:
URL: https://github.com/apache/nuttx/pull/20726#issuecomment-6237582841
<!-- membrowse-pr-comment -->
## <img src="https://membrowse.com/membrowse-logo.svg" height="24" align="top"> MemBrowse Memory Report
*No memory changes detected for:*
- [arduino-mega2560](https://membrowse.com/public/apache/nuttx/target/arduino-mega2560/compare?head=70e23186527a5628eddb8438c6e7af61f0617e24&base=17747ded0aaba11af1dd07422c15354200e65e3e)
- [esp32-devkitc](https://membrowse.com/public/apache/nuttx/target/esp32-devkitc/compare?head=70e23186527a5628eddb8438c6e7af61f0617e24&base=17747ded0aaba11af1dd07422c15354200e65e3e)
- [hifive1-revb](https://membrowse.com/public/apache/nuttx/target/hifive1-revb/compare?head=70e23186527a5628eddb8438c6e7af61f0617e24&base=17747ded0aaba11af1dd07422c15354200e65e3e)
- [mirtoo](https://membrowse.com/public/apache/nuttx/target/mirtoo/compare?head=70e23186527a5628eddb8438c6e7af61f0617e24&base=17747ded0aaba11af1dd07422c15354200e65e3e)
- [qemu-armv8a](https://membrowse.com/public/apache/nuttx/target/qemu-armv8a/compare?head=70e23186527a5628eddb8438c6e7af61f0617e24&base=17747ded0aaba11af1dd07422c15354200e65e3e)
- [qemu-intel64](https://membrowse.com/public/apache/nuttx/target/qemu-intel64/compare?head=70e23186527a5628eddb8438c6e7af61f0617e24&base=17747ded0aaba11af1dd07422c15354200e65e3e)
- [rx65n-rsk2mb](https://membrowse.com/public/apache/nuttx/target/rx65n-rsk2mb/compare?head=70e23186527a5628eddb8438c6e7af61f0617e24&base=17747ded0aaba11af1dd07422c15354200e65e3e)
- [s698pm-dkit](https://membrowse.com/public/apache/nuttx/target/s698pm-dkit/compare?head=70e23186527a5628eddb8438c6e7af61f0617e24&base=17747ded0aaba11af1dd07422c15354200e65e3e)
- [stm32-nucleo-f103rb](https://membrowse.com/public/apache/nuttx/target/stm32-nucleo-f103rb/compare?head=70e23186527a5628eddb8438c6e7af61f0617e24&base=17747ded0aaba11af1dd07422c15354200e65e3e)
--
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: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org