[PATCH 2/2] dbus: expose interface globals via D-Bus properties

Dan Williams dcbw
Mon Oct 12 10:08:25 PDT 2015


On Mon, 2015-10-12 at 19:05 +0300, Jouni Malinen wrote:
> On Wed, Oct 07, 2015 at 05:16:58PM -0500, Dan Williams wrote:
> > All interface globals are now exposed as D-Bus properties of type
> > string, and parsed via the normal interface global parsing functions.
> 
> This did not compile with number of gcc warnings enabled and once those

Which warnings do you have enabled?  I should enable those too.  I have
gcc 4.9.2 and default CFLAGS, so that means " -MMD -O2 -Wall -g" per
Makefile.  Perhaps you're using gcc 5.x and it has enabled some new
warning flags by default?

> issues were fixed, wpabuf_alloc() overflow in introspection kills the
> process.. That fixed, dbus_introspect test case passed, but there were

I increased the buffer allocation there at least once already for
introspection, but I suppose it dependsa on how much you've compiled in
with CONFIG_xxx=y.  We should fix that better there in the future,
instead of just bumping the value.  Also, we should just allocate that
once since it's never going to change.

> so many memory leaks that I did not really want to spend any more time
> on this..

Which ones?  The only memory allocated in this 2/2 patch is
wpas_dbus_all_interface_properties which is allocated when the first
wifi interface is added and then kept in-memory after that since it is
constant and needed whenever another interface is added.  There's no
point in allocating it per-interface since that would just waste memory.
Inside that, we need to convert the wpa-supplicant property name to a
D-Bus style one, so that requires another allocation but again this is
constant and long-lived.

I'm now converting this global array to one that is allocated on dbus
interface setup and freed when the global dbus interface is de-inited.
That ensures that no memory is left allocated at exit, with the downside
that the supplicant will now always allocate this memory, regardless of
whether or not any interface is ever added.

> The current snapshot of the patches from my work branch is here:
> http://w1.fi/p/dbus-globals/
> 
> Would it be possible for you to run these through the mac80211_hwsim
> test cases and resubmit a version that does not fail any of the D-Bus
> test cases ("./vm-run-sh -f dbus" in tests/hwsim/vm) or leak memory
> while going through those tests?

I'll do that, can you let me know which gcc warnings you're using so I
can ensure the v2 patch fixes them?

Dan




More information about the Hostap mailing list