Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 29 Nov 2013 14:59:59 +0400
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        jb <jb.1234abcd@gmail.com>
Cc:        freebsd-current@freebsd.org
Subject:   Re: [RFC] how to get the size of a malloc(9) block ?
Message-ID:  <20131129105959.GF90895@FreeBSD.org>
In-Reply-To: <loom.20131128T161159-463@post.gmane.org>
References:  <CA%2BhQ2%2BiNurBQnmH-4-DN9V-krc_R=dbEaznJkxLDOzkJEWpFMg@mail.gmail.com> <loom.20131128T143120-188@post.gmane.org> <20131128140637.GA62346@onelab2.iet.unipi.it> <loom.20131128T161159-463@post.gmane.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Nov 28, 2013 at 03:13:53PM +0000, jb wrote:
j> > But I don't understand why you find ksize()/malloc_usable_size() dangerous.
j> > ...
j> 
j> The original crime is commited when *usable size* (an implementation detail)
j> is exported (leaked) to the caller.
j> To be blunt, when a caller requests memory of certain size, and its request is
j> satisfied, then it is not its business to learn details beyond that (and they
j> should not be offered as well).
j> The API should be sanitized, in kernel and user space.
j> Otherwise, all kind of charlatans will try to play hair-raising games with it.
j> If the caller wants to track the *requested size* programmatically, it is its
j> business to do it and it can be done very easily.

+1

This is kind of APIs that just shouldn't exist.

-- 
Totus tuus, Glebius.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20131129105959.GF90895>