|
Home About Us A-Z Index Search * Contact Us Register Login Press ShopThe Open Brand -- Problem Reporting and Interpretations System |
Problem Report 1178 Details
Show help | Quick Search | Submit a Test Suite Support Request | Click here to view your privileges
This page provides all information on Problem Report 1178.
Report 1178 Actions
Problem Report Number 1178 Submitter's Classification Test Suite problem State Resolved Resolution Rejected (REJ) Problem Resolution ID REJ.X.0380 Raised 1970-01-01 08:00 Updated 2003-03-13 08:00 Published null Product Standard Internationalised System Calls and Libraries Extended (UNIX 95) Certification Program The Open Brand certification program Test Suite VSU version 4.1.11 Test Identification base/mmap 9 12 21 Problem Summary PG4U.00087 This IR claims that mmap() should fail when mapping a region larger than the current size of the file. Problem Text
In the above test cases, a temporary file is created which is used
for mapping. The size of the file created is 8192 bytes, and mmap()
is invoked as follows:
if ((ask_addr = (int *)mmap((void *)0, (size_t)(3*pgsz),
PROT_NONE, MAP_SHARED, fd1, 0)) == (int *)-1)
{
fwerrno("mmap");
return;
}
The size of the process area to be mapped, which is (3*pgsz)
where pgsz is 4096, is 12288. This is greater than the file
size and so mmap() fails with errno set to ENXIO. This
behaviour of mmap() is in line with the XPG4.2 specification,
which states:
mmap() function will fail if:
[ENXIO] Addresses in the range [off, off + len)
are invalid for the file descriptor.
To ensure passing of mmap() in the above test purposes, size of the file
created must be 12288 bytes.Test Output
TEST CASE: mmap
TEST PURPOSE #9
A call to void *mmap(void *addr, size_t len, int prot,
int flags, int fildes, off_t off) when fildes is
associated with a regular file and the MAP_FIXED flag
is set in flags shall cause the file associated with
fildes to be mapped at an address exactly matching
addr.
PREP: Obtain the system page size by call to
sysconf(_SC_PAGESIZE)
pgsz = 4096
PREP: Establish signal handlers for SIGSEGV and SIGBUS
PREP: Open a file and initialize it
PREP: Allocate memory for buffer
PREP: Now set proper permissions and re-open file
PREP: Find a fixed address for mapping text
ERROR: mmap failed, errno = 6(ENXIO - No such device or address)
9 FAIL
TEST PURPOSE #12
References to mapped pages beyond the page containing
the last byte of a file mapped by a call to void
*mmap(void *addr, size_t len, int prot, int flags, int
fildes, off_t off) shall result in the delivery of a
SIGBUS or a SIGSEGV signal.
PREP: Obtain the system page size by call to
sysconf(_SC_PAGESIZE)
pgsz = 4096
PREP: Establish signal handlers for SIGSEGV and SIGBUS
PREP: Allocate memory for buffer
PREP: Open a file and initialize it
TEST: mmap() with MAP_SHARED returns location where
file is mapped
ERROR: mmap failed, errno = 6(ENXIO - No such device or address)
12 FAIL
TEST PURPOSE #21
EINVAL in errno and return -1 on a call to void
*mmap(void *addr, size_t len, int prot, int flags, int
fildes, off_t off) when addr is not a multiple of the
page size returned by sysconf(_SC_PAGESIZE) and
MAP_FIXED is specified.
PREP: Obtain the system page size by call to
sysconf(_SC_PAGESIZE)
pgsz = 4096
PREP: Establish signal handlers for SIGSEGV and SIGBUS
PREP: Open a file and initialize it
PREP: Allocate memory for buffer
PREP: Now set proper permissions and re-open file
PREP: Find a fixed address not aligned to page boundary
ERROR: mmap failed, errno = 6(ENXIO - No such device or address)
21 FAILReview Information
Review Type TSMA Review Start Date null Completed null Status Complete Review Recommendation No Resolution Given Review Response
We recommend this request be refused.
We believe the test is correct.
The length specified is valid for the possible address space of the
file. The standard states for the mmap() function,
The address ranges covered by [pa, pa + len) and [off, off +
len) must be legitimate for the possible (not necessarily
current) address space of a process and the file,
respectively.
As a result, it allows pages to be mapped that are beyond the current
end of the file and ENXIO should not be returned. The key phrase here
is, "not necessarily current."
The standard provides the user with errors and signals to detect when
references to invalid portions of the file are made, but otherwise,
the user is free to mmap() currently non-existent portions of a file
that may be become valid prior to the user referencing those currently
non-existent portions of the file.
Review Type SA Review Start Date null Completed null Status Complete Review Resolution Rejected (REJ) Review Conclusion
This request is refused.
Problem Reporting System Options:
- View Report 1178
- List All PRs
- Search Reports
- Email the System Administrator
- View the The Open Brand Interpretations Database User Manual
Contact the Certification Authority