HomeAbout Us A-Z IndexSearch * Contact Us Register LoginPress Shop

The Open Brand -- Problem Reporting and Interpretations System


Problem Report 0259 Details

Help Show help | Quick Search | Submit a Test Suite Support Request | Click here to view your privileges

This page provides all information on Problem Report 0259.


Report 0259 Actions


    Problem Report Number 0259
    Submitter's Classification Test Suite problem
    State Resolved
    Resolution Test Suite Deficiency (TSD)
    Problem Resolution ID TSD.X.0259
    Raised 1997-04-16 08:00
    Updated 2003-03-13 08:00
    Published 1997-04-21 08:00
    Product Standard Internationalised System Calls and Libraries (XPG4)
    Certification Program The Open Brand certification program
    Test Suite VSX4 version 4.3.6
    Test Identification ANSI.os/genuts/T.free 1
    Problem Summary TSD4.259 The new VSX4.3.6 test suite version is too restrictive/specific in verifying conformance to the X/Open Spec for ANSI.os/genuts/free/T.free[1] test. The standard states that "The free() function causes...
    Problem Text
    ***********************************************************************

    The new VSX4.3.6 test suite version is too restrictive/specific in verifying
    conformance to the X/Open Spec for ANSI.os/genuts/free/T.free[1] test.
    The standard states that "The free() function causes the space pointed to by
    ptr to be made available for further allocation".

    Our version of free() does in fact causes the space to be made available for
    further allocation, it just doesn't do it immediately. The modified code
    (isolated and line-numbered) below shows that an intervening set of calls to
    malloc and free (lines 35-42) causes the test case to succeed:

    ==================

    1 #include <stdlib.h>
    2 #include <stdio.h>
    3 #include <errno.h>
    4 #include <malloc.h>
    5
    6 main(argc, argv)
    7 int argc;
    8 char *argv[];
    9 {
    10 char *memold;
    11 char *memfoo;
    12 char *memnew;
    13 size_t size;
    14 int i, j;
    15 int pathok = 0;
    16
    17 if (argc<2)
    18 {
    19 printf("No size given; using a default value of 600 bytes\n\n");
    20 size = 600;
    21 }
    22 else
    23 size=atoi(argv[1]);
    24 printf("SIZE = %ld\n\n", size);
    25 /* malloc a block and free it */
    26 if ((memold = (char *)malloc(size)) == (char *) NULL)
    27 {
    28 printf("failed to malloc() %ld bytes of memory", (long)size);
    29 return;
    30 }
    31 else
    32 ++pathok;
    33 printf( "A. ---> memold = (0x%x)\n", memold);
    34 free((void *)memold);
    35 /* malloc a block and free it */
    36 if ((memfoo = (char *)malloc(size)) == (char *) NULL)
    37 {
    38 printf("failed to malloc() %ld bytes of memory", (long)size);
    39 return;
    40 }
    41 printf( "A. ---> memfoo = (0x%x)\n", memfoo);
    42 free((void *)memfoo);
    43 for (i=0; i<3; i++)
    44 {
    45 /* malloc a new block and check if it overlaps the freed block */
    46 if ((memnew = (char *)malloc(size)) == (char *) NULL)
    47 {
    48 printf("failed to malloc() %ld bytes of memory %d times",
    49 (long)size, i+1);
    50 return;
    51 }
    52 else
    53 ++pathok;
    54 printf( "\n---------------------\n");
    55 printf( "B. ---> memnew = (0x%x)\n", memnew);
    56 for (j = 0; j < size; j++)
    57 {
    58 if ((j==0) || (j==(size-1)))
    59 {
    60 printf( "C. ---> memold+j = (0x%x)\n", memold+j );
    61 printf( "D. ---> memnew+size = (0x%x)\n", memnew+size );
    62 }
    63 if (memnew == memold+j || memnew+size == memold+j)
    64 {
    65 if (pathok == i+2)
    66 printf("=============== OK =====================\n\n");
    67 else
    68 {
    69 printf("path tracing error: counter %d, expected %d",
    70 pathok, i+2);
    71 }
    72 return;
    73 }
    74 }
    75 }
    76 /* if you reach here ==> FAILURE to use freed memory */
    77 printf("\nFAILED to reuse freed memory in next %d malloc() calls\n", i);
    78 }
    79
    ==================

    In our opinion, requiring the space to be made available immediately
    is too restrictive. Some leeway needs to exist in the standards test
    to allow for the historical behavior of the malloc/free/realloc routines
    in UNIX. There are some applications that depend on this behavior and
    would break if we eliminated this "feature".

    ***********************************************************************
    Test Output
    ************************************************************************
    /tset/ANSI.os/genuts/free/T.free 1 Failed

    Test Description:
    free() frees the block pointed to by ptr and makes it available for
    further allocation.
    Posix Ref: Component FREE Assertion 8.1-04(A)

    Test Strategy:
    CREATE child process
    CHILD process will
    CALL malloc() to allocate 20 bytes
    CALL free() to free the area of memory just allocated
    REPEAT 1000 times:
    CALL malloc() to allocate 20 bytes
    CHECK whether area of memory just allocated overlaps area
    previously freed
    VERIFY that an overlap was found

    Test Information:
    failed to reuse freed memory in next 1000 malloc() calls

    ************************************************************************

    Review Information

    Review Type TSMA Review
    Start Date null
    Completed null
    Status Complete
    Review Recommendation No Resolution Given
    Review Response
    It is accepted that this is a Test Suite Deficiency and it is recommended
    that a waiver is granted.

    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:

     

    Back   


Contact the Certification Authority