Added test case to test mmap with MAP_FIXED_NOREPLACE flag
PATCH v2 1/1 Added test case to test mmap with MAP_FIXED_NOREPLACE flag
This patch adds a new test case for the mmap syscall. It tests the MAP_FIXED_NOREPLACE flag of mmap. The code checks if MAP_FIXED_NOREPLACE returns with EEXIST when mapped with an already mapped address. It does so by allocating an available address by passing NULL to first argument of mmap and tries to mmap with MAP_FIXED_NOREPLACE flag at the same address returned by the first mmap call. This fails as expected. It also does the necessary changes required to run the syscall using the runltp command after building the LTP test suite.
Git Hub Issue link - https://github.com/linux-test-project/ltp/issues/299
--- include/lapi/mmap.h | 10 +++ runtest/syscalls | 1 + testcases/kernel/syscalls/mmap/.gitignore | 1 + testcases/kernel/syscalls/mmap/mmap17.c | 85 +++++++++++++++++++++++ 4 files changed, 97 insertions(+) create mode 100644 testcases/kernel/syscalls/mmap/mmap17.c
include/lapi/mmap.h +10 -0
@@ -66,6 +66,16 @@# define MADV_KEEPONFORK 19#endif +#ifndef MAP_FIXED_NOREPLACE + +#ifdef __alpha__ +# define MAP_FIXED_NOREPLACE 0x200000 +#else +# define MAP_FIXED_NOREPLACE 0x100000 +#endif + +#endif /* MAP_FIXED_NOREPLACE */ +#ifdef HAVE_SYS_SHM_H # include <sys/shm.h> # define MMAP_GRANULARITY SHMLBA
runtest/syscalls +1 -0
@@ -745,6 +745,7 @@ mmap14 mmap14 #mmap11 mmap11 -i 30000 mmap15 mmap15 mmap16 mmap16 +mmap17 mmap17 modify_ldt01 modify_ldt01 modify_ldt02 modify_ldt02
testcases/kernel/syscalls/mmap/.gitignore +1 -0
@@ -15,3 +15,4 @@ /mmap14 /mmap15 /mmap16 +/mmap17
testcases/kernel/syscalls/mmap/mmap17.c new file +85 -0
85 lines not on this page · raw message
--
2.20.1
PATCH v2 1/1 Added test case to test mmap with MAP_FIXED_NOREPLACE flag
----- Original Message -----
Quoted 11 lines
This patch adds a new test case for the mmap syscall. It tests the
MAP_FIXED_NOREPLACEflag of mmap. The code checks ifMAP_FIXED_NOREPLACEreturns with EEXIST when mapped with an already mapped address. It does so by allocating an available address by passing NULL to first argument of mmap and tries to mmap withMAP_FIXED_NOREPLACEflag at the same address returned by the first mmap call. This fails as expected. It also does the necessary changes required to run the syscall using the runltp command after building the LTP test suite.
Git Hub Issue link - https://github.com/linux-test-project/ltp/issues/299
Quoted 2 lines
Signed-off-by Kushal Chand <[email protected]>Reviewed-by Vijay Kumar B. <[email protected]>
Added include to lapi/mmap.h, slightly modified commit message and pushed.
Thanks,
Jan