posix: Use PROT_READ for tst-mmap address probe

Message ID 20260929153656.6247-1-muhammad.kamran@arm.com (mailing list archive)
State Committed
Commit aea569495b18321dbe96f334e9510f73a2a57a6a
Headers
Series posix: Use PROT_READ for tst-mmap address probe |

Checks

Context Check Description
redhat-pt-bot/TryBot-apply_patch success Patch applied to master at the time it was sent
linaro-tcwg-bot/tcwg_glibc_build--master-arm success Build passed
redhat-pt-bot/TryBot-32bit success Build for i686
linaro-tcwg-bot/tcwg_glibc_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_glibc_check--master-arm success Test passed
linaro-tcwg-bot/tcwg_glibc_check--master-aarch64 success Test passed

Commit Message

Muhammad Kamran Sept. 29, 2026, 3:36 p.m. UTC
  Use PROT_READ for the anonymous mmap used to obtain a page-aligned
address to avoid possible unrelated permission-related mmap
failures.
---
 posix/tst-mmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Adhemerval Zanella Oct. 8, 2026, 11:13 a.m. UTC | #1
On 29/09/26 17:36, Muhammad Kamran wrote:
> Use PROT_READ for the anonymous mmap used to obtain a page-aligned
> address to avoid possible unrelated permission-related mmap
> failures.

LGTM, thanks.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

> ---
>  posix/tst-mmap.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/posix/tst-mmap.c b/posix/tst-mmap.c
> index 8f71744a30..6b06f41d69 100644
> --- a/posix/tst-mmap.c
> +++ b/posix/tst-mmap.c
> @@ -93,7 +93,7 @@ do_test (void)
>      }
>  
>    /* Get a valid, page-aligned address.  */
> -  mem = mmap (NULL, 2 * ps, PROT_NONE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
> +  mem = mmap (NULL, 2 * ps, PROT_READ, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
>    if (mem != MAP_FAILED)
>      {
>        void *addr = (char *) mem + 1;
  

Patch

diff --git a/posix/tst-mmap.c b/posix/tst-mmap.c
index 8f71744a30..6b06f41d69 100644
--- a/posix/tst-mmap.c
+++ b/posix/tst-mmap.c
@@ -93,7 +93,7 @@  do_test (void)
     }
 
   /* Get a valid, page-aligned address.  */
-  mem = mmap (NULL, 2 * ps, PROT_NONE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+  mem = mmap (NULL, 2 * ps, PROT_READ, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
   if (mem != MAP_FAILED)
     {
       void *addr = (char *) mem + 1;