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 3d2ee4f49b01857789b91a79e796f04741e44108
Author: Marco Casaroli <[email protected]>
AuthorDate: Mon Oct 19 21:34:40 2026 +0200

    Documentation: Update the mprotect() support.
    
    mprotect() checks its arguments in all builds.  It changes the page
    permissions with CONFIG_ARCH_ADDRENV on arm64 and RISC-V.  On other
    targets a valid request returns success and changes nothing.
    
    Assisted-by: Claude Code:claude-opus-5-5
    Signed-off-by: Marco Casaroli <[email protected]>
---
 Documentation/standards/posix.rst | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/Documentation/standards/posix.rst 
b/Documentation/standards/posix.rst
index 4e3d3ac034c..6d010beb7a0 100644
--- a/Documentation/standards/posix.rst
+++ b/Documentation/standards/posix.rst
@@ -193,9 +193,10 @@ POSIX.1 Option Requirements
 | `_POSIX_THREAD_PROCESS_SHARED`_ | 201712L     |                           |
 +---------------------------------+-------------+---------------------------+
 
-.. [#fn9] NuttX provides dummy implementations for ``_POSIX_MEMORY_PROTECTION``
-          which is sufficient for devices without MMU, but doesn't meet the
-          requirement for devices with MMU.
+.. [#fn9] ``mprotect()`` changes the page permissions only with
+          ``CONFIG_ARCH_ADDRENV`` on arm64 and RISC-V.  On other targets it
+          checks the arguments and changes nothing, which is sufficient for
+          devices without MMU.
 
 POSIX PSE54 - Multipurpose
 --------------------------
@@ -2923,11 +2924,16 @@ _POSIX_MEMORY_PROTECTION
 +--------------------------------+----------------+
 | API                            | Support        |
 +================================+================+
-| :c:func:`mprotect`             | Dummy [#fn17]_ |
+| :c:func:`mprotect`             | Yes [#fn17]_   |
 +--------------------------------+----------------+
 
-.. [#fn17] The function returns a success value but doesn't implement
-           the required functionality.
+.. [#fn17] All builds return ``EINVAL`` when ``addr`` is not a multiple of
+           ``sysconf(_SC_PAGESIZE)`` or ``prot`` has an unknown bit.  With
+           ``CONFIG_ARCH_ADDRENV`` on arm64 and RISC-V the function changes
+           the page permissions, and returns ``ENOMEM`` when a page of the
+           range is not mapped.  Other configurations return a success value
+           for a valid request and change nothing: without an MMU the
+           permissions cannot be enforced.
 
 _POSIX_PRIORITIZED_IO
 ---------------------

Reply via email to