All of lore.kernel.org
 help / color / mirror / Atom feed
From: xueshi hu <hubachelar@gmail.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] change mmap flags from PROT_EXEC to PROT_READ
Date: Tue, 23 Mar 2021 21:31:37 +0800	[thread overview]
Message-ID: <20210323133137.2280947-1-hubachelar@gmail.com> (raw)

In some architecture(e.g., mips), PROT_EXEC doesn't guarantee PROT_READ,
which will cause segment fault. In others architectures, PROT_READ is
more accurate.

Signed-off-by: xueshi hu <hubachelar@gmail.com>
---
 testcases/kernel/syscalls/mmap/mmap03.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/testcases/kernel/syscalls/mmap/mmap03.c b/testcases/kernel/syscalls/mmap/mmap03.c
index b957a3218..2fcf1ef17 100644
--- a/testcases/kernel/syscalls/mmap/mmap03.c
+++ b/testcases/kernel/syscalls/mmap/mmap03.c
@@ -85,7 +85,7 @@ int main(int ac, char **av)
 		 * with execute access.
 		 */
 		errno = 0;
-		addr = mmap(0, page_sz, PROT_EXEC,
+		addr = mmap(0, page_sz, PROT_READ,
 			    MAP_FILE | MAP_SHARED, fildes, 0);
 
 		/* Check for the return value of mmap() */
-- 
2.25.1


             reply	other threads:[~2021-03-23 13:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-23 13:31 xueshi hu [this message]
2021-07-21 16:34 ` [LTP] [PATCH] change mmap flags from PROT_EXEC to PROT_READ Cyril Hrubis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210323133137.2280947-1-hubachelar@gmail.com \
    --to=hubachelar@gmail.com \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.