talloc_tos() vs talloc_stackframe()

Jeremy Allison jra at samba.org
Fri Jul 6 15:37:42 UTC 2018


On Mon, Jul 02, 2018 at 04:25:00PM +1200, Andrew Bartlett via samba-technical wrote:
> On Fri, 2018-06-22 at 07:46 +0200, Volker Lendecke wrote:
> 
> > We must never return memory for later use on top of
> > talloc_tos().
> 
> I strongly agree.  Can someone please have a look at
> source3/smbd/posix_acls.c?  Every function within that file seems to
> assume that talloc_tos() memory lasts until some top-level caller, and
> returns memory on that context.

Guilty as charged :-). In my defense, that is old code
and was one of the first users of talloc_tos() before
we learned how to effectively use it.

I'll try and produce cleanup patches to this, so long
as they don't break VFS compat (and for master, even
if they do :-).

> In related news, we did find the sysvolreset performance issue, it is
> actually the uid_entry_in_group() call hidden in there, re-building the
> user's SID list (tokenGroups) for every ACL just to see if the user
> might be in a group! 

Great ! Good debugging work.

Jeremy.



More information about the samba-technical mailing list