All of lore.kernel.org
 help / color / mirror / Atom feed
From: Xiao Yang <yangx.jy@cn.fujitsu.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v2 1/5] syscalls/mremap03: Do not pass MAP_FAILED into mremap()
Date: Tue, 13 Feb 2018 16:41:36 +0800	[thread overview]
Message-ID: <1518511300-12371-1-git-send-email-yangx.jy@cn.fujitsu.com> (raw)
In-Reply-To: <20180212162258.GA26897@rei>

Running mremap03 -i n got the following errors:
-----------------------------------------------
mremap03    1  TPASS  :  mremap() Fails, 'old region not mapped', errno 14
mremap03    1  TFAIL  :  mremap03.c:137: mremap() Fails, 'Unexpected errno 22
...
-----------------------------------------------

When running mremap03 in loops, we passed MAP_FAILED instead of bad
address into mremap().

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
---
 testcases/kernel/syscalls/mremap/mremap03.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/testcases/kernel/syscalls/mremap/mremap03.c b/testcases/kernel/syscalls/mremap/mremap03.c
index 12e3829..5cd1a67 100644
--- a/testcases/kernel/syscalls/mremap/mremap03.c
+++ b/testcases/kernel/syscalls/mremap/mremap03.c
@@ -84,7 +84,8 @@
 
 char *TCID = "mremap03";
 int TST_TOTAL = 1;
-char *addr;			/* addr of memory mapped region */
+static char *bad_addr;
+static char *addr;		/* addr of memory mapped region */
 int memsize;			/* memory mapped size */
 int newsize;			/* new size of virtual memory block */
 
@@ -111,7 +112,7 @@ int main(int ac, char **av)
 		 * virtual address was not mapped.
 		 */
 		errno = 0;
-		addr = mremap(addr, memsize, newsize, MREMAP_MAYMOVE);
+		addr = mremap(bad_addr, memsize, newsize, MREMAP_MAYMOVE);
 		TEST_ERRNO = errno;
 
 		/* Check for the return value of mremap() */
@@ -173,7 +174,7 @@ void setup(void)
 	 * Set the old virtual address point to some address
 	 * which is not mapped.
 	 */
-	addr = (char *)get_high_address();
+	bad_addr = (char *)get_high_address();
 }
 
 /*
-- 
1.8.3.1




  reply	other threads:[~2018-02-13  8:41 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-09  7:56 [LTP] [PATCH 1/4] lib/get_high_address.c: Add tst_get_high_address.h for new API Xiao Yang
2018-02-09  7:56 ` [LTP] [PATCH 2/4] syscalls/unlink05, 06: Cleanup && Convert to " Xiao Yang
2018-02-09  7:56 ` [LTP] [PATCH 3/4] syscalls/unlink07: " Xiao Yang
2018-02-09  7:56 ` [LTP] [PATCH 4/4] syscalls/unlink08: " Xiao Yang
2018-02-12 16:22 ` [LTP] [PATCH 1/4] lib/get_high_address.c: Add tst_get_high_address.h for " Cyril Hrubis
2018-02-13  8:41   ` Xiao Yang [this message]
2018-02-13  8:41     ` [LTP] [PATCH v2 2/5] lib/get_high_address.c: Add tst_get_bad_addr.h " Xiao Yang
2018-02-13 13:42       ` Cyril Hrubis
2018-02-14  6:19         ` [LTP] [PATCH v3 1/4] " Xiao Yang
2018-02-14  6:19           ` [LTP] [PATCH v3 2/4] syscalls/unlink05, 06: Cleanup && Convert to " Xiao Yang
2018-02-14  6:19           ` [LTP] [PATCH v3 3/4] syscalls/unlink07: " Xiao Yang
2018-02-14  6:19           ` [LTP] [PATCH v3 4/4] syscalls/unlink08: " Xiao Yang
2018-02-20 16:08           ` [LTP] [PATCH v3 1/4] lib/get_high_address.c: Add tst_get_bad_addr.h for " Cyril Hrubis
2018-02-22  5:48             ` [LTP] [PATCH v4 " Xiao Yang
2018-02-22  5:48               ` [LTP] [PATCH v4 2/4] syscalls/unlink05, 06: Cleanup && Convert to " Xiao Yang
2018-02-27 10:24                 ` Cyril Hrubis
2018-02-22  5:48               ` [LTP] [PATCH v4 3/4] syscalls/unlink07: " Xiao Yang
2018-02-27 10:25                 ` Cyril Hrubis
2018-02-22  5:48               ` [LTP] [PATCH v4 4/4] syscalls/unlink08: " Xiao Yang
2018-02-27 10:26                 ` Cyril Hrubis
2018-02-27 10:23               ` [LTP] [PATCH v4 1/4] lib/get_high_address.c: Add tst_get_bad_addr.h for " Cyril Hrubis
2018-02-13  8:41     ` [LTP] [PATCH v2 3/5] syscalls/unlink05, 06: Cleanup && Convert to " Xiao Yang
2018-02-13  8:41     ` [LTP] [PATCH v2 4/5] syscalls/unlink07: " Xiao Yang
2018-02-13  8:41     ` [LTP] [PATCH v2 5/5] syscalls/unlink08: " Xiao Yang
2018-02-13 13:04     ` [LTP] [PATCH v2 1/5] syscalls/mremap03: Do not pass MAP_FAILED into mremap() 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=1518511300-12371-1-git-send-email-yangx.jy@cn.fujitsu.com \
    --to=yangx.jy@cn.fujitsu.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.