PR0009.html

LSB Problem Report

Problem Report Number 0009 (TSD.0006)
Submitter's Classification Test Suite Problem (TSD)
State Resolved
Resolution Test Suite Deficiency (TSD)
Raised 2002-08-04 17:36
Updated 2002-08-22 18:05
Published 2002-08-22 18:05
Certification Program Linux Standard Base Conformance Release 1.2
Test Suite lsb-runtime IA32 version 1
Test Identification LSB.os/mprotect/mprotect_P/T.mprotect_P.4
Problem Summary mprotect tests inconsistent in use of mmap/munmap
Problem Text This description is copied from a report by a Debian
maintainer; this problem has been seen on at least two
other implementations.

Running the binary test suite on Debian gives a
reproducible hang in T.mprotect_P tp 4 -- it leaves two
processes busy looping that'll only die with a SIGKILL.

Some investigation shows that it's actually testcase 3
that's the problem: running tests 1-3 alone finishes, but
segfaults. Likewise running test cases 1,2,4-11 finishes
with reasonable results. Running test cases 3 and 5 causes
the same busy looping behaviour.

The problem seems to be the calls to mmap and munmap in
test3(): vsrt_pgsz bytes are mmap'ed, then 3*vsrt_pgsz
bytes are munmap'ed -- and thus anything mmap'ed in the
2*v_p bytes after our block of memory gets munmap'ed too,
and segfaults and suchlike result on accesses to it.
Presumably the sig{set,long}jmp used to check the behaviour
thus causes infinite loops.

Related issues: test4 mmap's more than it munmap's. test10
mmap's something, then never munmap's it.
SRC/common/vsrtlib/mkmmap.c also has places where it's
possible that the mmap/munmap calls are not in sync (e.g.
mmap "size" pages, then later unmap 3 pages instead
of "size", where size might have been something other than
3).

A patch (for tp 3,4) is:

--- mprotect_P.c.busted Sat Aug 3 01:22:41 2002
+++ mprotect_P.c Sat Aug 3 01:25:18 2002
@@ -458,7 +458,7 @@
} else
errors += WEXITSTATUS(status);

- (void)munmap((void*)adr1, (size_t)(3*vsrt_pgsz));
+ (void)munmap((void*)adr1, (size_t)(vsrt_pgsz));

close(fd);
unlink(test_file);
@@ -567,7 +567,7 @@
} else
errors += WEXITSTATUS(status);

- munmap((void *)adr, (size_t)vsrt_pgsz);
+ munmap((void *)adr, (size_t)(3*vsrt_pgsz));

unlink(test_file);
Test Output No truly relevant test output: test hangs and must be
manually killed. Here's a snip from a journal where this
has been done:

10|596 /tset/LSB.os/mprotect/mprotect_P/T.mprotect_P
15:41:04|TC Start, scenario ref 601-0
15|596 3.3-lite 11|TCM Start
400|596 1 1 15:41:05|IC Start
200|596 1 15:41:05|TP Start
220|596 1 0 15:41:07|PASS
410|596 1 1 15:41:07|IC End
400|596 2 1 15:41:07|IC Start
200|596 2 15:41:07|TP Start
220|596 2 0 15:41:09|PASS
410|596 2 1 15:41:09|IC End
400|596 3 1 15:41:09|IC Start
200|596 3 15:41:09|TP Start
220|596 3 0 15:41:11|PASS
410|596 3 1 15:41:11|IC End
400|596 4 1 15:41:11|IC Start
200|596 4 15:41:11|TP Start
220|596 4 7 16:01:39|NORESULT (auto-generated by TCC)
90|16:01:39|User Abort
80|596 2304 16:01:39|TC End, scenario ref 601-0

Review Information

Review Type TSMA Review
Start Date 2002-08-04 17:36
Last Updated 2002-08-15 14:36
Completed 2002-08-15 14:36
Status Complete
Review Recommendation Test Suite Deficiency (TSD)
Review Response A test suite deficiency is recommended

Review Type SA Review
Start Date 2002-08-15 13:36
Last Updated 2002-08-22 13:09
Completed 2002-08-22 13:09
Status Complete
Review Resolution Test Suite Deficiency (TSD)
Review Conclusion SA concurrs with TSD.

 

Copyright 2005, The Free Standards Group, All Rights Reserved