[libvirt] [PATCH 1/5] write pid file into stateDir

Guido Günther agx at sigxcpu.org
Fri Dec 12 20:59:25 UTC 2008


On Fri, Dec 12, 2008 at 08:42:10PM +0100, Jim Meyering wrote:
> Guido Günther <agx at sigxcpu.org> wrote:
> > diff --git a/tests/qemuxml2argvdata/qemuxml2argv-hostdev-usb-address.args b/tests/qemuxml2argvdata/qemuxml2argv-hostdev-usb-address.args
> > index 3d6c16d..e1c5638 100644
> > --- a/tests/qemuxml2argvdata/qemuxml2argv-hostdev-usb-address.args
> > +++ b/tests/qemuxml2argvdata/qemuxml2argv-hostdev-usb-address.args
> > @@ -1 +1 @@
> > -LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb -usbdevice host:014.006
> > +LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor pty -pidfile /tmp/QEMUGuest1.pid -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb -usbdevice host:014.006
> > diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
> > index 6e5355a..585eb08 100644
> > --- a/tests/qemuxml2argvtest.c
> > +++ b/tests/qemuxml2argvtest.c
> > @@ -156,6 +156,8 @@ mymain(int argc, char **argv)
> >
> >      if ((driver.caps = testQemuCapsInit()) == NULL)
> >          return EXIT_FAILURE;
> > +    if((driver.stateDir = strdup("/tmp")) == NULL)
> > +        return EXIT_FAILURE;
> >
> >  #define DO_TEST(name, extraFlags)                                       \
> >      do {                                                                \
> 
> Hi Guido,
> 
> Please don't use a world-writable directory like /tmp for this, since
> someone running this test on a multi-user system would then be vulnerable
> to a symlink attack for any predictably-named file it creates in that
> directory.
No file is acutally written there, but I'll change that to "/nowhere" so
there isn't any confiusion about this.
 -- Guido




More information about the libvir-list mailing list