mmap test 23-1 is testing for one condition while violating another
 constraint.

 pipe() returns two fds, one with read-only permissions and one with
 write-only permissions. mmap() requires that there be at least read
 permissions. The 23-1 test is trying to open the write-only end of the
 pipe with PROT_READ|PROT_WRITE, which fails because read permissions
 are not granted on the file descriptor. AFAIK SuS doesn't specify an
 error code precedence that would force -ENODEV to be returned.

 Previously this test succeeded due only to the ordering of the tests
 in the Linux kernel. Changes introduced in git commit
 80c5606c3b45e0176c32d3108ade1e1cb0b954f3 re-ordered the tests, which
 caused the test for FMODE_READ to be above those for f_op->mmap(),
 causing the mmap() call to return -EACCES instead of -ENODEV.

 This patch changes the test to use the read-only end of the pipe with
 PROT_READ permissions, which passes the FMODE_READ check on the file
 descriptor and returns -ENODEV.

Signed-off-by: Jeff Mahoney <[EMAIL PROTECTED]>

---

 testcases/open_posix_testsuite/conformance/interfaces/mmap/23-1.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)


--- a/testcases/open_posix_testsuite/conformance/interfaces/mmap/23-1.c 
2007-10-30 21:30:55.000000000 -0400
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mmap/23-1.c 
2007-10-30 21:27:43.000000000 -0400
@@ -35,7 +35,7 @@
   void *pa = NULL; 
   void *addr = NULL;
   size_t len = 1024;
-  int prot = PROT_READ | PROT_WRITE;
+  int prot = PROT_READ;
   int flag = MAP_SHARED;
   int fd;
   off_t off = 0;
@@ -47,7 +47,7 @@
     exit(PTS_UNRESOLVED);
   }
   
-  fd = pipe_fd[1]; 
+  fd = pipe_fd[0];
   pa = mmap(addr, len, prot, flag, fd, off);
   if (pa == MAP_FAILED && errno == ENODEV)
   {
@@ -59,7 +59,7 @@
   else 
   {
     printf ("Test Fail: " TNAME 
-            " Expect ENODEF, get: %s\n", strerror(errno));    
+            " Expect ENODEV, get: %s\n", strerror(errno));
     close(pipe_fd[0]);
     close(pipe_fd[1]);
     exit(PTS_FAIL);

-- 
Jeff Mahoney
SUSE Labs

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to