Hi,

We met the mtest06 failure several times; this is because in
mtest06/mmap1.c, when handling the signal 11 in sig_handler, it doesn't
cover another two race conditions:
one is si_code equals "SEGV_MAPERR" but si_address does not equal to
map_address; and one is si_code equals to "SEGV_ACCERR"; 

see below error log:

<<<test_start>>>
tag=mtest06 stime=1270902396
cmdline="  mmap1 -x 0.05"
contacts=""
analysis=exit
initiation_status="ok"
<<<test_output>>>
mmap1       0  INFO  :  pid[5456]: map, change contents, unmap files
1000 times
mmap1       0  INFO  :  created thread[1216369840]
mmap1       0  INFO  :  pid[5456] - read contents of memory 0x48002000
1000 times
mmap1       0  INFO  :  page fault occurred at 0x48002000
mmap1       0  INFO  :  page fault occurred at 0x48002000
mmap1       0  INFO  :  page fault occurred at 0x48002000
mmap1       0  INFO  :  page fault occurred at 0x48002000
......
mmap1       0  INFO  :  page fault occurred at 0x48002000
mmap1       0  INFO  :  page fault occurred at 0x48002000
caught unexpected signal - 11 --- exiting
<<<execution_status>>>
duration=1 termination_type=exited termination_id=255 corefile=no
cutime=0 cstime=4
<<<test_end>>>

I made a patch to cover all the three race conditions in one case in
sig_handler(), 
then run mtest06 repeatedly on different archs, test will not fail by
catching signal 11.

See attached patch.

Thanks,
Renxiu
From cb3a3032acf818a69e6d7bd028d4b0c927b0fac4 Mon Sep 17 00:00:00 2001
From: Renxiu Liang <[email protected]>
Date: Mon, 16 Aug 2010 19:57:54 -0700
Subject: [PATCH 1/1] Fix sig_handler() for SIGSEGV in mmap1.c

"mtest06" is aimed at stressing the memory manager by simultanious
map/unmap/read by light weight processes; it tries to handle
SIGSEGV signal in sig_handler instead of doing synchronizations
between read and write threads; two more race conditions are
not covered: one is si_code equals "SEGV_MAPERR" but si_address
does not equal to map_address; the other is si_code equals to
"SEGV_ACCERR"; try to cover the three conditions in one case
to reduce the complexity.

Signed-off-by: Renxiu Liang <[email protected]>
---
 testcases/kernel/mem/mtest06/mmap1.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/testcases/kernel/mem/mtest06/mmap1.c b/testcases/kernel/mem/mtest06/mmap1.c
index 47ab49a..7eb3547 100644
--- a/testcases/kernel/mem/mtest06/mmap1.c
+++ b/testcases/kernel/mem/mtest06/mmap1.c
@@ -168,14 +168,10 @@ sig_handler(int signal,		/* signal number, set to handle SIGALRM       */
              _exit(0);
 
         case SIGSEGV:
-             if (info->si_code == SEGV_MAPERR &&
-                      info->si_addr == map_address)
-             {
-                  tst_resm(TINFO,
+             tst_resm(TINFO,
                     "page fault occurred at %p",
                     map_address);
-                  longjmp(jmpbuf, 1);
-             }
+             longjmp(jmpbuf, 1);
         default:
             fprintf(stderr, "caught unexpected signal - %d --- exiting\n",
                      signal);
-- 
1.6.1

------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to