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

Daniel P. Berrange berrange at redhat.com
Fri Dec 12 20:28:19 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.

Agree in general. This case is OK actually ok, and neccessary  because we 
dont actually launch QEMU from the test suite - we merely generate various 
ARGV sets and compare them to expected output. So we do in fact need a 
predictable, static path for purposes of the comparison.

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list