From: Jan Stancek <jstancek@redhat.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v1] Added test case to test mmap with MAP_FIXED_NOREPLACE flag
Date: Mon, 8 Jun 2020 05:57:52 -0400 (EDT) [thread overview]
Message-ID: <472905204.15124870.1591610272008.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <20200608092635.15248-1-kushalchand@zilogic.com>
----- Original Message -----
>
> 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
>
> Signed-off-by: Kushal Chand <kushalchand@zilogic.com>
> Reviewed-by: Vijay Kumar B. <vijaykumar@zilogic.com>
>
Hi,
> +static void test_mmap(void)
> +{
> + int str_len;
> + void *address;
> +
> + str_len = strlen(str);
> +
> + SAFE_WRITE(1, fd_file1, str, str_len);
> + mapped_address = SAFE_MMAP(NULL, str_len, PROT_WRITE,
> + MAP_PRIVATE, fd_file1, 0);
> +
> + SAFE_WRITE(1, fd_file2, str, str_len);
> +
> + address = mmap(mapped_address, str_len, PROT_WRITE,
> + MAP_PRIVATE | MAP_FIXED_NOREPLACE, fd_file2, 0);
This needs fallback definition in lapi/mmap.h, otherwise it won't compile
on older distros.
prev parent reply other threads:[~2020-06-08 9:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-08 9:26 [LTP] [PATCH v1] Added test case to test mmap with MAP_FIXED_NOREPLACE flag Kushal Chand
2020-06-08 9:57 ` Jan Stancek [this message]
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=472905204.15124870.1591610272008.JavaMail.zimbra@redhat.com \
--to=jstancek@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox