|
Home About Us A-Z Index Search * Contact Us Register Login Press ShopThe Open Brand -- Problem Reporting and Interpretations System |
Problem Report 1575 Details
Show help | Quick Search | Submit a Test Suite Support Request | Click here to view your privileges
This page provides all information on Problem Report 1575.
Report 1575 Actions
Problem Report Number 1575 Submitter's Classification Test Suite problem State Resolved Resolution Test Suite Deficiency (TSD) Problem Resolution ID TSD.X.0857 Raised 2002-12-04 08:00 Updated 2003-03-13 08:00 Published 2003-01-13 08:00 Product Standard Internationalised System Calls and Libraries Extended V2 (UNIX 98) Certification Program The Open Brand certification program Test Suite VSU version 5.1.2 Test Identification CAPI.os/sockets/sendmsg 12 Problem Summary TSD4U.00318 The test tries to allocate a large amount of memory and then forks. If the malloc() succeeds then the fork() may fail with ENOMEM. Problem Text
This is the output from a passing run of this assertion:
400|434 12 1 12:31:19|IC Start
200|434 12 12:31:19|TP Start
520|434 12 00012757 1 1|PREP: Read IOV_MAX system configuration
520|434 12 00012757 1 2|PREP: Test whether condition can be generated
520|434 12 00012757 1 3|PREP: Set up invalid iovec
520|434 12 00012757 1 4|INFO: Malloc of 2147483648 bytes failed, trying smaller
size
520|434 12 00012757 1 5|TEST: AF_INET SOCK_STREAM
520|434 12 00012757 1 6|PREP: Create test sockaddr_in: address = 192.29.85.234,
port = 2913
520|434 12 00012757 2 1|PREP: Wait for server to be ready
...
220|434 12 0 12:31:21|PASS
410|434 12 1 12:31:21|IC End
Notice the malloc() fails. On the machines with enough memory, the
malloc() will pass.
Looking at the test code:
static void
test12C(void)
{
...
void *TestData2;
int fNeedFree;
...
tet_infoline("PREP: Set up invalid iovec");
if((TestData2 = malloc((size_t)1 << ((CHAR_BIT * sizeof(size_t)) - 1))) == NULL) {
sprintf(ebuf,"INFO: Malloc of %lu bytes failed, trying smaller size",(unsigned long)1 << ((CHAR_BIT * sizeof(size_t)) - 1));
tet_infoline(ebuf);
if((TestData2 = sbrk(0)) == NULL) {
uwerrno("sbrk");
return;
}
fNeedFree = 0;
}
else
fNeedFree = 1;
...
for (i=0; i < iovnum; i++) {
if (imp_socks[i].imp_has != 0) {
...
if (imp_socks[i].family == AF_INET) {
s2 = inet_default(&sin5);
if (s2 == -1) {
if (fNeedFree == 1)
free(TestData2);
return;
}
/*this creates an echo server which will send us back whatever we write*/
pid = inet_server(imp_socks[i].type, 0, &sin5);
if (pid == -1) {
if (fNeedFree == 1)
free(TestData2);
return;
}
tet_infoline("PREP: Wait for server to be ready"
);
...
}
And the code for inet_server():
pid_t inet_server(int type, long flags, struct sockaddr_in *sin5)
{
...
if ((pid = fork()) != 0) {
tet_setblock();
if (pid == -1) {
uwerrno("inet_server: fork");
vsu_debug_exit("capi_sock/inet.c:inet_server()", "parent");
return((pid_t)-1);
}
vsu_debug_exit("capi_sock/inet.c:inet_server()", "parent");
return(pid);
}
...
}
In the machines with larger memory sizes, the malloc() in test12c()
passes, allocating 2147483648 bytes for TestData2. In the other
machines, this malloc() fails and the tests set TestData2 to the
value returned by sbrk(0), which is smaller.
Later, in inet_server() a fork() is attempted. On the systems where
the malloc() failed, this works fine. On the systems where it passed,
fork() fails because it cannot duplicate the memory needed by the
TestData2 pointer.
According to the standard for fork():
"The new process (child process) is an exact copy of the calling process
(parent process) except as detailed below:"
The exceptions do not mention memory usage except with regards to
mapped memory, which this process is not using. Therefore, it is
correct for fork() to be attempting to copy the memory allocated to
TestData2 when it is called.
The test then fails when fork() returns ENOMEM, which is acceptable
behavior from fork().
Again from the standard:
"The fork() function may fail if:
[ENOMEM] Insufficient storage space is available."
It appears the test is making a bad assumption that it can successfully
fork() after allocating such a large amount of space to TestData2.Test Output
10|0 /tset/CAPI.os/sockets/sendmsg/T.sendmsg 14:24:57|TC Start, scenario ref 1-0
15|0 3.3-lite 48|TCM Start
400|0 12 1 14:25:13|IC Start
200|0 12 14:25:13|TP Start
520|0 12 00019112 1 1|PREP: Read IOV_MAX system configuration
520|0 12 00019112 1 2|PREP: Test whether condition can be generated
520|0 12 00019112 1 3|PREP: Set up invalid iovec
520|0 12 00019112 1 4|TEST: AF_INET SOCK_STREAM
520|0 12 00019112 1 5|PREP: Create test sockaddr_in: address = 192.29.85.112, po
rt = 1497
520|0 12 00019112 2 1|ERROR: inet_server: fork failed, errno = 12(ENOMEM - Not e
nough space)
220|0 12 2 14:25:13|UNRESOLVED
410|0 12 1 14:25:13|IC EndReview Information
Review Type TSMA Review Start Date null Completed null Status Complete Review Recommendation No Resolution Given Review Response
This is accepted as a fault in the test suite.
Review Type SA Review Start Date null Completed null Status Complete Review Resolution Test Suite Deficiency (TSD) Review Conclusion
This is an agreed Test Suite Deficiency.
Problem Reporting System Options:
- View Report 1575
- List All PRs
- Search Reports
- Email the System Administrator
- View the The Open Brand Interpretations Database User Manual
Contact the Certification Authority