talloc_tos() Re: 617ec07 ?

Andrew Bartlett abartlet at samba.org
Tue Aug 10 16:27:21 MDT 2010


On Tue, 2010-08-10 at 13:23 -0700, Jeremy Allison wrote:
> On Tue, Aug 10, 2010 at 08:29:57PM +0200, Volker Lendecke wrote:
> > Hi!
> > 
> > Just for my understanding: Does 617ec07 mean that
> > talloc_tos() will eventually have to die, now that we share
> > more and more code and it will not be supported in Samba4?
> > 
> > Thanks,
> 
> IMHO - talloc_tos() is too important an idiom to
> remove from shared code. 

Currently it isn't used in shared code, but I understand you concerns
regarding code that will become shared. 

> We depend on it too much
> in source3, and it's possible in merging code that
> we'll miss things that will cause leaks. Remember,
> a talloc_free() on a talloc stackframe cleans up
> all below, so removing talloc_tos() means adding
> relevent talloc_free() calls for everything previously
> allocated on that frame. I'm worried we'll miss
> something.
> 
> How can we address this so that we can keep
> using talloc_tos() in shared code ?

Currently the Samba4 event loops etc are not set up to do the top level
stackframe processing.  

For this simple case, where we allocate exactly one variable and then
free it, it seemed simplest to just allocate it on another context.  

Now, I know that argument can apply to any patch, and indeed could be
seen as the start of a slow undoing of this code.  Rest assured that
this was not my intention.

Honestly, I'm not a great fan of talloc_tos().  I've had it explained to
me multiple times, and I appreciate that it both works and solves real
world problems, but things like the SMB_ASSERT() on allocation failure
and (more particularly) it being just a little bit opaque still makes me
uncomfortable. 

Regardless of this, as this is an important and well used part of Samba
infrastructure, I will try to look at any proposal/patch to add the
support infrastructure for this in the source4 codebase with an open
mind. 

Andrew Bartlett
-- 
Andrew Bartlett                                http://samba.org/~abartlet/
Authentication Developer, Samba Team           http://samba.org
Samba Developer, Cisco Inc.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20100811/ef029eef/attachment.pgp>


More information about the samba-technical mailing list