Email List: Xaustin-review-lX
[All Lists]

(Fwd) Defect in mmap, munmap, mprotect, msync (previously mmap, munmap,

To: yyyyyyyyyyyyyyy@xxxxxxxxxxxxx
Subject: (Fwd) Defect in mmap, munmap, mprotect, msync (previously mmap, munmap, mprotect, msync conflict)
From: Andrew Josey <yyyyyy@xxxxxxxxxxxxxxxxx>
Date: Mon, 14 Nov 2005 16:41:12 GMT
This was intended for this reflector.

--- Forwarded mail from Peter van der Veen <peterv:qnx.com>


Since there was no discussion I'm posting this as a defect.

@ Page 787 Line 25836 Section mmap Objection [austin-review-l-41]
@ Page 795 Line 26120 Section mprotect() Objection []
@ Page 827 Line 27064 Section msync() Objection []
@ Page 832 Line 27168 Section munmap() Objection []

Problem:
Previously conforming implementations of POSIX become invalid with newer
versions. The previous specifications (POSIX 1003.1-1996 and earlier) do not
require page alignment of addr and offset. They even have the wording "NOTE:
It is expected that a later amendment of this standard will disallow the
implementation from imposing the restriction on the alignment of the off and
addr arguments." POSIX1003.1-2001 adopted the wording from SUSv2 which is
conflicting, requiring the application to align the arguments.
The 1996 and earlier wording allows both implementations to co-exist, but
the 2001 and later wording does not.
The 1003.1-2004 XRAT volume is still worded to match the earlier
specification, page 120, line 4915, section B2.8.3:
"The mmap() and munmap() functions allow a process to manipulate their
address space by mapping portions of memory objects into it and removing
them from it. When multiple processes map the same memory object, they can
share access to the underlying data. Implementations may restrict the size
and alignment of mappings to be on page-size boundaries."
This alignment conflict applies to mmap, munmap, mprotect and msync.

Action:
Delete lines 25836-25841:

The off argument is constrained to be aligned and sized according to the
value returned by sysconf() when passed _SC_PAGESIZE or _SC_PAGE_SIZE. When
MAP_FIXED is specified, the application shall ensure that the argument addr
also meets these constraints. The implementation performs mapping operations
over whole pages. Thus, while the argument len need not meet a size or
alignment constraint, the implementation shall include, in any mapping
operation, any partial page specified by the range [pa,pa+len).

After line 25841 add:

If MAP_FIXED is specified and addr is nonzero, it shall have the same
remainder as the off parameter, modulo the page size as returned by
sysconf() when passed _SC_PAGESIZE or _SC_PAGE_SIZE. The implementation may
require that off is a multiple of the page size. If MAP_FIXED is specified,
the implementation may require that addr is a multiple of the page size. The
system performs mapping operations over whole pages. Thus, while the
parameter len need not meet a size or alignment constraint, the system shall
include, in any mapping operation, any partial page specified by the address
range starting at pa and continuing for len bytes.


Delete lines 25882-25884:

[EINVAL] The addr argument (if MAP_FIXED was specified) or off is not a
multiple of the page size as returned by sysconf( ), or is considered
invalid by the implementation.

After line 25907 add:

The mmap() function may fail if:
[EINVAL] The addr argument (if MAP_FIXED was specified) or off is not a
multiple of the page size as returned by sysconf( ), or is considered
invalid by the implementation.

Delete lines 26120-26121:

The implementation shall require that addr be a multiple of the page size as
returned by sysconf().

After line 26121 add:

The implementation may require that addr be a multiple of the page size,
{PAGESIZE}.

Delete line 26136:

[EINVAL] The addr argument is not a multiple of the page size as returned by
sysconf().

After line 26143 add:
The mprotect() function may fail if:
[EINVAL] The addr argument is not a multiple of the page size as returned by
sysconf().

Delete lines 27064-27065:

The implementation shall require that addr be a multiple of the page size as
returned by sysconf().

After line 27065 add:

The implementation may require that addr be a multiple of the page size as
returned by sysconf().

Delete line 27099:

[EINVAL] The value of addr is not a multiple of the page size {PAGESIZE}.

After line 27102 add:

The msync() function may fail if:
[EINVAL] The value of addr is not a multiple of the page size as returned by
sysconf().

Delete line 27168:

The implementation shall require that addr be a multiple of the page size
{PAGESIZE}.

After line 27168 add:

The implementation may require that addr be a multiple of the page size as
returned by sysconf().

Delete line 27192:

[EINVAL] The addr argument is not a multiple of the page size as returned by
sysconf().

After line 27192 add:

The munmap() function may fail if:
[EINVAL] The addr argument is not a multiple of the page size as returned by
sysconf().


---End of forwarded mail from Peter van der Veen <peterv:qnx.com>

<Prev in Thread] Current Thread [Next in Thread>
  • (Fwd) Defect in mmap, munmap, mprotect, msync (previously mmap, munmap, mprotect, msync conflict), Andrew Josey <=