This is an automated email from the ASF dual-hosted git repository.

GUIDINGLI pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new ffbf179bb99 fs/mmap: copy writable private mappings of XIP-backed files
ffbf179bb99 is described below

commit ffbf179bb9912f842d88d98e5367b260790c0de7
Author: jingfei <[email protected]>
AuthorDate: Fri Nov 27 20:48:14 2026 +0800

    fs/mmap: copy writable private mappings of XIP-backed files
    
    A writable private mapping needs its own RAM copy even when the backing
    file offers a direct XIP address. Keep the existing copy path for that
    case and retain direct XIP mapping for shared or read-only mappings.
    
    Signed-off-by: jingfei <[email protected]>
---
 fs/mmap/fs_rammap.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/mmap/fs_rammap.c b/fs/mmap/fs_rammap.c
index cb5697589ff..f043ecdbdc4 100644
--- a/fs/mmap/fs_rammap.c
+++ b/fs/mmap/fs_rammap.c
@@ -259,7 +259,8 @@ int rammap(FAR struct file *filep, FAR struct 
mm_map_entry_s *entry,
   size_t length = entry->length;
 
   ret = file_ioctl(filep, BIOC_XIPBASE, (unsigned long)&entry->vaddr);
-  if (ret == OK)
+  if (ret == OK &&
+      ((entry->flags & MAP_PRIVATE) == 0 || (entry->prot & PROT_WRITE) == 0))
     {
       if (entry->offset < 0)
         {

Reply via email to