NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/48910: msync(2) should return ENOMEM on unmapped pages per POSIX; test criteria in t_msync incorrect



>Number:         48910
>Category:       kern
>Synopsis:       msync(2) should return ENOMEM on unmapped pages per POSIX; 
>test criteria in t_msync incorrect
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jun 15 11:50:00 +0000 2014
>Originator:     Garrett Cooper
>Release:        n/a
>Organization:
EMC / Isilon Storage Division
>Environment:
n/a
>Description:
The msync_err testcase checks for EFAULT when testing msync(2) with an 
previously mapped address, but that requirement isn't listed in the msync(2) 
manpage, nor is it listed as the correct error to throw per POSIX:

165 ATF_TC_BODY(msync_err, tc)
166 {
...
176         errno = 0;
177 
178         /*
179          * Map a page and then unmap to get an unmapped address.
180          */
181         map = mmap(NULL, page, PROT_READ | PROT_WRITE, MAP_ANON | 
MAP_PRIVATE,
182             -1, 0);
183         ATF_REQUIRE(map != MAP_FAILED);
184 
185         (void)munmap(map, page);
186 
187         ATF_REQUIRE(msync(map, page, MS_SYNC) != 0);
188         ATF_REQUIRE(errno == EFAULT);
189 }

The errno that should be checked is ENOMEM (from 
http://pubs.opengroup.org/onlinepubs/000095399/functions/msync.html ):

[ENOMEM]
The addresses in the range starting at addr and continuing for len bytes are 
outside the range allowed for the address space of a process or specify one or 
more pages that are not mapped.
>How-To-Repeat:
- Change the errno in t_msync from EFAULT to ENOMEM.
- Recompile the testcase.
- Re-run the testcase.
>Fix:



Home | Main Index | Thread Index | Old Index