This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Report on the bounded pointers work


On Tue, Nov 05, 2013 at 08:55:21AM -0700, Jeff Law wrote:
> On 11/05/13 03:35, Florian Weimer wrote:
> >On 11/04/2013 05:43 PM, Joseph S. Myers wrote:
> >>On Mon, 4 Nov 2013, Jeff Law wrote:
> >>
> >>>You might also be referring to Greg McGary's work on bounded
> >>>pointers, I don't
> >>>think that ever got integrated or if it did, it got pulled long ago.
> >>
> >>It was integrated in 2000, removed in 2002/2003 (I removed the relics
> >>from
> >>glibc earlier this year).  By using fat pointers, it required the entire
> >>program including all libraries it used to be built with bounded pointers
> >>enabled (and associated changes to all assembly sources to handle them).
> >
> >Yes, I was referring to Greg's work.  I'm wondering if the trade-offs
> >have changed since then, considering that it's again en vogue to
> >bootstrap new architectures.  It's difficult to tell without more
> >details about that past effort, though.
> Not really, IMHO.  If anything as software complexity continues to
> increase (specifically pulling in more and more libraries from
> various sources), the problem of mixing instrumented and
> uninstrumented code has actually gotten worse.
> 
Also it is doing useless work, allocator already knows bounds so all you
need to do is ask.

A query can be made O(1) with bit of work, I attached a proof of concept
allocator that checks memcpy where queries are unoptimized O(n).

As it is this will not get bounds on static and stack allocations. For
static allocations you could extract bounds by reading debug information
as gdb does.

For stack allocations it takes more work, it could be done by
compiler/compiler plugin/custom frontend inserting bound_add (from, to)
and bound_remove (from, to) calls for each stack variable that escaped.

Attachment: malloc_bound.c
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]