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

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

commit 0a368599d98023dd6ad1659a923ca7e9990872e4
Author: Marco Casaroli <[email protected]>
AuthorDate: Mon Oct 19 01:57:03 2026 +0200

    Documentation: Describe the owner and the group of files on v9fs.
    
    Tell which user and group V9FS gives to a new file, and what the QEMU
    security_model option does with them.  Recommend mapped-xattr in the
    v9fs page and in the qemu-armv8a 9p example.
    
    Assisted-by: Claude Code:claude-opus-5-5
    Signed-off-by: Marco Casaroli <[email protected]>
---
 Documentation/os/filesystem/v9fs.rst               | 26 ++++++++++++++++++++++
 .../arm64/qemu/boards/qemu-armv8a/index.rst        |  5 +++++
 2 files changed, 31 insertions(+)

diff --git a/Documentation/os/filesystem/v9fs.rst 
b/Documentation/os/filesystem/v9fs.rst
index cd9962a2da4..5e56eeb427c 100644
--- a/Documentation/os/filesystem/v9fs.rst
+++ b/Documentation/os/filesystem/v9fs.rst
@@ -26,6 +26,29 @@ last component of the path. ``rm`` of a link removes the 
link, not its
 target. A link with an absolute target is not followed and fails with
 ``ENOTSUP``, because the target is a path on the server.
 
+Owner and Group
+===============
+
+With ``CONFIG_SCHED_USER_IDENTITY``, V9FS attaches to the server once for
+each effective user ID that uses the mount. A new file, directory or
+symbolic link gets the effective user ID and the effective group ID of the
+caller. ``chown()`` and ``fchown()`` send ``Tsetattr``, and ``stat()``
+shows the owner and the group that the server returns.
+
+The server decides what it does with the owner. In QEMU, the
+``security_model`` option of ``-fsdev`` or ``-virtfs`` selects it:
+
+  - ``mapped-xattr``: QEMU keeps the owner, the group and the mode of a
+    file in extended attributes of the host file (``user.virtfs.uid``,
+    ``user.virtfs.gid``, ``user.virtfs.mode``). Use this model when
+    NuttX needs the owner and the group of its files.
+  - ``mapped-file``: the same, in hidden ``.virtfs_metadata`` files.
+  - ``passthrough``: QEMU changes the owner of the host file. QEMU must
+    run as root, else the creation of a file fails with ``EPERM``.
+  - ``none``: QEMU ignores the owner of a new file. ``stat()`` shows the
+    owner of the host file, and ``chown()`` fails with ``EPERM`` unless
+    QEMU runs as root.
+
 V9FS Mount Command
 ==================
 
@@ -54,6 +77,9 @@ Similarly, we need to bring the corresponding parameters in 
qemu
   -fsdev local,security_model=none,id=fsdev1,path=<share-path> \
   -device virtio-9p-device,id=fs1,fsdev=fsdev1,mount_tag=<mount_tag>
 
+Use ``security_model=mapped-xattr`` to keep the owner and the group of the
+files (see `Owner and Group`_).
+
 For how to start virtio-9p in QEMU, please refer to the document:
 
   - https://wiki.qemu.org/Documentation/9psetup
diff --git a/Documentation/platforms/arm64/qemu/boards/qemu-armv8a/index.rst 
b/Documentation/platforms/arm64/qemu/boards/qemu-armv8a/index.rst
index 8da7d5f60df..5bb87b8b0f9 100644
--- a/Documentation/platforms/arm64/qemu/boards/qemu-armv8a/index.rst
+++ b/Documentation/platforms/arm64/qemu/boards/qemu-armv8a/index.rst
@@ -227,6 +227,11 @@ Running with QEMU:
     mnt/
     proc/
 
+With ``security_model=none``, ``stat()`` shows the owner of the host file.
+To keep the owner, the group and the mode that NuttX gives to its files, use
+``security_model=mapped-xattr``. QEMU then keeps them in extended
+attributes of the host files. See :doc:`/os/filesystem/v9fs`.
+
 --------------------------------------
 Single Core with MTE Expansion (GICv3)
 --------------------------------------

Reply via email to