[systemd-devel] recursive dispatching of va_list (was: Re: [ANNOUNCE] systemd 200)

Lennart Poettering lennart at poettering.net
Tue Apr 9 12:37:33 PDT 2013


On Mon, 08.04.13 14:30, Lennart Poettering (lennart at poettering.net) wrote:

> On Fri, 05.04.13 23:33, Zbigniew Jędrzejewski-Szmek (zbyszek at in.waw.pl) wrote:
> 
> > > I had a go at debugging this... I think that the is the "return of the
> > > va_arg and undefined aps" horror. The result is that in test-bus-marshall.c:133
> > > and test-bus-marshall.c:139 (at least), some of the output arguments are not
> > > initialized at all and segfault happens. Under gdb I see that va_arg(ap, void*)
> > > returns &y twice.
> > > 
> > > According to va_arg(3), "If ap is passed to a function that uses
> > > va_arg(ap,type) then the value of ap is undefined after the return of
> > > that function." So message_read_ap calling itself recursively is not an
> > > option.
> > ...unless we implement DBUS_FORMAT_FORMAT_ADVANCE, which calls itself
> > recursively (yuck), and use va_copy (yuck). But maybe that's the way.
> 
> Ah, grmbl, yuck, grrrr... 
> 
> I will try to rewrite bus_message_read_ap() in a non-recurisve
> fashion. It should be possible to do that by more or less just using a
> hand-written stack of signature strings... I will look into it. Gonna be
> hard making this readable...

This is now in git. Would be cool if somebody could test if the tests
now pass on a 32bit arch! Philip? 

Thanks!

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list