Hi,

Version 2 actually fixes the SIGSEGV issue.

Sometimes, writev06 test case failed due to receiving a SIGSEGV signal,

<<<test_start>>>
tag=writev06 stime=1236859804
cmdline="writev06"
contacts=""
analysis=exit
initiation_status="ok"
<<<test_output>>>
writev06    1  BROK  :  Unexpected signal 11 received.
writev06    2  FAIL  :  unlink Failed--file = writev_data_file.23185,
errno = 2
incrementing stop
<<<execution_status>>>
duration=0 termination_type=exited termination_id=3 corefile=no
cutime=0 cstime=0
<<<test_end>>>

This is due to out of range access of array,

  ...
  char * bad_addr[2] = {NULL, NULL};
  ...
  bad_addr[2] = mmap(NULL, page_size * 3, PROT_NONE,
                     MAP_PRIVATE_EXCEPT_UCLINUX|MAP_ANONYMOUS, 0, 0);
  ...

In addition, The test gives too little information to figure it out what
might be wrong. The following patch makes it easier to debug this type
of failure by fixing error checking code for mmap() calls.

Signed-off-by: CAI Qian <[email protected]>

--- testcases/kernel/syscalls/writev/writev06.c.orig    2009-03-17 
16:10:44.000000000 +0800
+++ testcases/kernel/syscalls/writev/writev06.c 2009-03-18 16:32:57.000000000 
+0800
@@ -193,20 +193,23 @@
         * mapping around */
        bad_addr[0] = mmap(NULL, page_size * 3, PROT_NONE,
                        MAP_PRIVATE_EXCEPT_UCLINUX|MAP_ANONYMOUS, 0, 0);
+       if (bad_addr[0] == MAP_FAILED)
+               tst_brkm(TBROK, cleanup, "mmap failed for bad_addr[0]");        
+
        good_addr[0] = mmap(NULL, page_size, PROT_READ|PROT_WRITE,
                        MAP_PRIVATE_EXCEPT_UCLINUX|MAP_ANONYMOUS, 0, 0);
+       if (good_addr[0] == MAP_FAILED)
+               tst_brkm(TBROK, cleanup, "mmap failed for good_addr[0]");
+
        bad_addr[1] = mmap(NULL, page_size * 3, PROT_NONE,
                        MAP_PRIVATE_EXCEPT_UCLINUX|MAP_ANONYMOUS, 0, 0);
+       if (bad_addr[1] == MAP_FAILED)
+               tst_brkm(TBROK, cleanup, "mmap failed for bad_addr[1]");
+
        good_addr[1] = mmap(NULL, page_size, PROT_READ|PROT_WRITE,
                        MAP_PRIVATE_EXCEPT_UCLINUX|MAP_ANONYMOUS, 0, 0);
-       bad_addr[2] = mmap(NULL, page_size * 3, PROT_NONE,
-                       MAP_PRIVATE_EXCEPT_UCLINUX|MAP_ANONYMOUS, 0, 0);
-       
-       if (good_addr[0] <= 0 || good_addr[1] <= 0 ||
-                       bad_addr[0] <= 0 || bad_addr[0] <= 0 ||
-                       bad_addr[2] <= 0) {
-            printf("mmap failed\n");
-        }
+       if (good_addr[1] == MAP_FAILED)
+               tst_brkm(TBROK, cleanup, "mmap failed for good_addr[1]");
 
        /* force page fault for writable mappings*/
        memset(good_addr[0],'a', page_size);

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to