dbus crashing with no environment
Bastien Nocera
hadess at hadess.net
Tue Nov 25 08:04:51 PST 2008
On Tue, 2008-11-25 at 15:59 +0000, Daniel P. Berrange wrote:
> On Tue, Nov 25, 2008 at 03:18:40PM +0000, Bastien Nocera wrote:
> > Heya,
> >
> > I was trying to see why fprintd was crashing when using the service
> > activation, and Richard mentioned that I should try clearing the
> > environment as that's what the activation helper does.
> >
> > I don't actually need any environment in fprintd, so went ahead with it,
> > and ended up with crashes in dbus itself. fprintd uses dbus-glib, but I
> > was able to reproduce with the attached DBus-only test case.
>
> This does not appear to be neccessarily dbus's fault - change your
> demo program to just be
>
> #include <stdlib.h>
>
> int main (int argc, char **argv)
> {
> clearenv ();
> unsetenv("FOO");
> return 0;
> }
>
>
> And it'll also crash & burn the same way:
Duh. My mistake for not going deeper into it. Would you mind filing a
bug against glibc, or shall I do it?
> ==14998== Invalid read of size 4
> ==14998== at 0xB3A53F: unsetenv (setenv.c:295)
> ==14998== by 0x4008326: unsetenv (mc_replace_strmem.c:760)
> ==14998== by 0x8048415: main (env.c:6)
> ==14998== Address 0x0 is not stack'd, malloc'd or (recently) free'd
>
> So its arguably a bug in libc's unsetenv(), but we could guard against
> it in DBus by making the dbus_setenv do
>
> if (getenv("FOO")) unsetenv("FOO");
>
> Instead of calling unsetenv() unconditionally.
Probably a good idea.
More information about the dbus
mailing list