From sacadmin Mon Aug 14 11:18:45 2006
Received: from jurassic.eng.sun.com (jurassic.SFBay.Sun.COM [129.146.17.55])
	by sac.sfbay.sun.com (8.13.6+Sun/8.13.6) with ESMTP id k7EIIjx3026490
	for <psarc@sac.sfbay.sun.com>; Mon, 14 Aug 2006 11:18:45 -0700 (PDT)
Received: from jurassic (jurassic [129.146.104.45])
	by jurassic.eng.sun.com (8.13.8+Sun/8.13.8) with SMTP id k7EIIiGx602242;
	Mon, 14 Aug 2006 11:18:44 -0700 (PDT)
Message-Id: <200608141818.k7EIIiGx602242@jurassic.eng.sun.com>
Date: Mon, 14 Aug 2006 11:18:44 -0700 (PDT)
From: "Roger A. Faulkner" <Roger.Faulkner@eng.sun.com>
Reply-To: "Roger A. Faulkner" <Roger.Faulkner@eng.sun.com>
Subject: PSARC/2006/477 - malloc library cleanup
To: psarc@sac.sfbay.sun.com
Cc: jonathan.adams@sun.com, michael.pogue@sun.com
MIME-Version: 1.0
Content-Type: TEXT/plain; charset=us-ascii
Content-MD5: rXF5DIz0CxYEaWoJavKUqA==
X-Mailer: dtmail 1.3.0 @(#)CDE Version 1.7_44 SunOS 5.11 sun4u sparc 
Status: RO
Content-Length: 3032

I am sponsoring this fast-track case for myself.
This proposal will time out 08/21/2006

Over the course of years, with mistakes made along the way,
the following malloc interpositioning libraries have been
provided by Solaris:
        /usr/lib/libbsdmalloc.so.1
        /usr/lib/libmalloc.so.1
        /usr/lib/libmapmalloc.so.1
        /usr/lib/libmtmalloc.so.1
        /usr/lib/libumem.so.1
        /usr/lib/watchmalloc.so.1

Each of these libraries provides the minimum interfaces of:
        free()
        malloc()
        realloc()

In the case of libbsdmalloc.so.1, this is all it provides.
In the rest of the cases, these interfaces are provided:
        calloc()
        free()
        malloc()
        memalign()
        realloc()
        valloc()

and some of them also provide:
        cfree()
        mallinfo()
        mallopt()

The latter two actually do something in libmalloc.so.1.
They are provided in libmapmalloc.so.1 and watchmalloc.so.1
as do-nothing interfaces just so that these libraries can
be used as interposers on applications that are already linked
directly with libmalloc.so.1.

This is all fine and good, but due to mistakes made along the way,
starting with mistakes in libc.so.1, these interfaces are also
provided in varying mixtures, each of which is a synonym for
the corresponding non-leading-underscore function:
        _cfree()
        _mallinfo()
        _mallopt()
        _memalign()
        _valloc()

The mistake in libc.so.1 was to provide _cfree(), _memalign(),
and _valloc() as synonyms for cfree(), memalign(), and valloc(),
respectively.  This should never have been done, given that the
rules for the malloc interfaces require that all of the interfaces
be interposable-upon, even when called internally within libc.

This mistake resulted in the propagation of these names to some of
the malloc libraries.  A similar mistake was made in libmalloc.so.1
It provided the _mallinfo() and _mallopt() synonyms for mallinfo()
and mallopt() respectively, and these names were propagated to
libmapmalloc.so.1 and watchmalloc.so.1.

In libc.so.1, the offending interfaces are versioned as SUNWprivate,
so removing them requires no special dispensation.  However, they
are versioned as Public in the malloc interpositioning libraries
(the final mistake).

So this brings us to the reason for this PSARC case:

These unnecessary and unused interfaces should be removed from libc.so.1
and the above-mentioned malloc libraries, regardless of whether they are
versioned Public or Private:
        _cfree()
        _mallinfo()
        _mallopt()
        _memalign()
        _valloc()

No binary (executable or library) in the OS/NET consolidation contains
a reference to any of these symbols.  They appear in no manual page.
They are, by virtue of the leading underscore, not legitimately callable
from customer applications.

It would do no harm to make this change to the patch gates, but I only
anticipate doing it to the release under development (nevada, 11, whatever).

Roger Faulkner


