All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] open_posix_testsuite/mmap24-2: Support mips
Date: Tue, 27 Nov 2018 14:51:50 +0100	[thread overview]
Message-ID: <20181127135149.GA26575@rei.lan> (raw)
In-Reply-To: <1540348607-217391-1-git-send-email-hongzhi.song@windriver.com>

Hi!
First of all sorry for the late reply.

> Mips will return EINVAL instead of ENOMEM as expected
> if MAP_FIXED is set and the range of [addr + len) exceeds
> TASK_SIZE.
> 
> Linux kernel code: arch/mips/mm/mmap.c
> if (flags & MAP_FIXED) {
>     /* Even MAP_FIXED mappings must reside within TASK_SIZE */
>     if (TASK_SIZE - len < addr)
>         return -EINVAL;
> 
> The POSIX specification says:
> "If MAP_FIXED is set, mmap() may return MAP_FAILED and set errno to
> [EINVAL]."
> [http://pubs.opengroup.org/onlinepubs/9699919799/functions/mmap.html]
> 
> So I think the mips kernel remains POSIX compliant.

There is a subtle difference between the ENOMEM and EINVAL error for
MAP_FIXED though.

If you look at POSIX specification terminology it says that 'shall'
defines mandatory features while 'may' describes optional features.

Which means that the MAP_FIXED returning ENOMEM for addresses above
TASK_SIZE is mandatory since it's defined in the shall fail list. And
that EINVAL is recomended to be used for other unsuitable address that
fit into the process address space but are not suitable for a different
reasons which could be mostly translated to hardware limits.

To sum it up, as far as I can tell mips is not POSIX confirmant here and
even if this is a very minor issue we shouldn't change the test here.

-- 
Cyril Hrubis
chrubis@suse.cz

  parent reply	other threads:[~2018-11-27 13:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-24  2:36 [LTP] [PATCH] open_posix_testsuite/mmap24-2: Support mips Hongzhi.Song
2018-10-29  7:42 ` Hongzhi, Song
2018-11-01  1:49 ` Hongzhi, Song
2018-11-05  1:15   ` Hongzhi, Song
2019-07-19  1:38     ` Hongzhi, Song
2019-07-24  1:21       ` Hongzhi, Song
2018-11-27 13:51 ` Cyril Hrubis [this message]
2019-07-24  8:11   ` Hongzhi, Song

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=20181127135149.GA26575@rei.lan \
    --to=chrubis@suse.cz \
    --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.