[PATCH] PolicyKit refcounting

Ludwig Nussel ludwig.nussel at suse.de
Mon May 29 01:28:07 PDT 2006


On Thursday 25 May 2006 00:57, David Zeuthen wrote:
> On Wed, 2006-05-24 at 11:18 +0200, Ludwig Nussel wrote:
> > The reference was added using g_object_weak_ref, so use
> > g_object_weak_unref to remove it otherwise the objects gets
> > destroyed too early causing a crash later.
> 
> Yea, I can reproduce the crasher too (though not systematically) but I'm
> not sure this is the right fix as polit-manager.c:session_finalized()
> never references the object as it by design is called when the object
> have been finalized. It merely looks through a hash table and tries to
> remove the element for which the value equals the pointer.
> 
> I'm curious if it fixed it for you though? Maybe just not unreffing the
> object made the difference but then there might be leaks elsewhere.

It didn't crash anymore with the patch. Without the patch it crashes in
data_from_pam(). The object gets referenced due to the iochannel (in
polkit_session_initiate_auth()) and gets unreferenced in data_from_pam() when
the channel receives G_IO_HUP. bus_name_owner_changed() therefore must not
remove the reference added for the iochannel.

> So, I've got a rather huge patch (~3000 lines) that I will commit over
> holiday weekend (Sat -> Mon) and then I will try to make some sense out
> of the refcounting issues we currently have. Then we should be good to
> release 0.2 with a big "needs security review" label all over it.

Last week I looked at polkitd and how it relates to resmgrd. TBH I
don't feel comfortable with polkitd. I do like the idea with
privileges and granting them on demand but using dbus for the job
seems to be unnecessary overkill. There is probably no daemon needed
at all (neither resmgrd nor polkitd).

cu
Ludwig

-- 
 (o_   Ludwig Nussel
 //\   SUSE LINUX Products GmbH, Development
 V_/_  http://www.suse.de/



More information about the hal mailing list