From: "Hongzhi, Song" <hongzhi.song@windriver.com>
To: <linux-kernel@vger.kernel.org>, <mm-commits@vger.kernel.org>
Subject: Question about mmap syscall and POSIX standard on mips arch
Date: Thu, 18 Oct 2018 11:26:02 +0800 [thread overview]
Message-ID: <e897b11f-1577-9298-7c82-7bbdea56e7e5@windriver.com> (raw)
Hi all,
Ltp has a POSIX teatcase about mmap, 24-2.c.
https://github.com/linux-test-project/ltp/blob/e816127e5d8efbff5ae53e9c2292fae22f36838b/testcases/open_posix_testsuite/conformance/interfaces/mmap/24-2.c#L94
-----part of code-----
pa = mmap(addr, len, PROT_READ | PROT_WRITE, MAP_FIXED |
MAP_SHARED, fd,
0);
if (pa == MAP_FAILED && errno == ENOMEM) {
printf("Got ENOMEM: %s\nTest PASSED\n", strerror(errno));
exit(PTS_PASS);
}
-----end----------------
Under POSIX standard, the expected errno should be ENOMEM
when the specific [addr+len] exceeds the bound of memory.
But mips returns EINVAL.
https://github.com/torvalds/linux/blob/bab5c80b211035739997ebd361a679fa85b39465/arch/mips/mm/mmap.c#L69
-------part of code-------
if (flags & MAP_FIXED) {
/* Even MAP_FIXED mappings must reside within TASK_SIZE */
if (TASK_SIZE - len < addr)
return -EINVAL;
-------end------------------
So, can we change EINVAL to ENOMEM to follow POSIX standard?
--Hongzhi
next reply other threads:[~2018-10-18 3:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-18 3:26 Hongzhi, Song [this message]
2018-10-18 4:32 ` Al Viro
2018-10-18 23:09 ` Paul Burton
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=e897b11f-1577-9298-7c82-7bbdea56e7e5@windriver.com \
--to=hongzhi.song@windriver.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mm-commits@vger.kernel.org \
/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
all inboxes | Powered by JetHome®