Commit Graph

2909 Commits

Author SHA1 Message Date
Richard W.M. Jones
913945e0cb Version 1.10.12. 1.10.12 2011-12-22 20:29:02 +00:00
Richard W.M. Jones
6b68c17e07 df: Disable part of virt-df test.
See:
https://www.redhat.com/archives/libguestfs/2011-November/msg00051.html
(cherry picked from commit 6e6b3ff35f)
2011-12-22 19:50:11 +00:00
Richard W.M. Jones
bfc9d17904 daemon: Use pkg-config to locate Augeas CFLAGS / libraries.
Augeas 0.10 depends on libxml2, so this is now required in the
appliance (in fact, it was already present).

However this exposed two bugs:

(1) In libguestfs we use a home-brewed recipe for Augeas flags,
resulting in this error:
/usr/include/augeas.h:24:25: fatal error: libxml/tree.h: No such file or directory

(2) Augeas's own augeas.pc didn't include the libxml2 flags, so
it was broken.  This requires a patch to Augeas 0.10, see:
https://www.redhat.com/archives/augeas-devel/2011-December/msg00008.html

Change to using pkg-config to detect Augeas.  It is still an optional
library.

Cherry picked from commit 615924abaa and
rebased for old libguestfs branches that had separate
daemon/configure.ac.
2011-12-22 19:22:39 +00:00
Richard W.M. Jones
70d65ae969 Security: Mitigate possible privilege escalation via SG_IO ioctl (CVE-2011-4127, RHBZ#757071)
CVE-2011-4127 is a serious qemu & kernel privilege escalation bug
found by Paolo Bonzini.

http://seclists.org/oss-sec/2011/q4/536

An untrusted guest kernel is able to issue special SG_IO ioctls on
virtio devices which qemu passes through to the host kernel without
filtering or sanitizing.  These ioctls allow raw sectors from the
underlying host device to be read and written.  Significantly, neither
qemu nor the host kernel checks that the range of sectors is within
the partition / LV assigned to the guest.  For example, if the guest
is assigned host partition /dev/sda3, it would be able to read or
write any part of /dev/sda including other partitions and the boot
sector.  Exploits through LVs passed to the guest are also possible,
with some limitations.  File-backed virtual block devices are not
vulnerable.  Non-virtio block devices are not vulnerable.

This patch mitigates the problem by disabling the SG_IO ioctl
passthrough in qemu.  Thus if libguestfs is examining an untrusted
guest and the libguestfs appliance/daemon is compromised (eg. by
executing guest commands, or through some other compromise), then the
compromised appliance will not be able to issue the above SG_IO ioctls
and exploit the host.

Note that this is just mitigation for libguestfs.  Users will still
want to fully update their host kernel, qemu/KVM and libvirt, in order
to prevent other (non-libguestfs) routes to compromise.

The following versions of libguestfs (will/have) this patch applied.

  libguestfs >= 1.15.13
  libguestfs >= 1.14.8
  libguestfs >= 1.12.11
  libguestfs >= 1.10.12
  libguestfs >= 1.8.16

Earlier versions may be vulnerable unless a downstream packager has
applied this patch.

Cc: Hilko Bengen <bengen@hilluzination.de>
(cherry picked from commit 9a5f784d51)
2011-12-22 18:41:10 +00:00
Richard W.M. Jones
90b708cba2 Version 1.10.11. 1.10.11 2011-11-10 10:43:40 +00:00
Richard W.M. Jones
051fc05ccc daemon: Don't use files with fixed names in /tmp (thanks Steve Kemp).
Although this doesn't matter for the ordinary (appliance) case, it
matters for the libguestfs live case.  In that case it could cause the
guest to be exploited by a tmp/symlink attack.
(cherry picked from commit 6011b1f803)
2011-11-09 22:16:19 +00:00
Richard W.M. Jones
7aae04efa0 Version 1.10.10. 1.10.10 2011-10-31 11:26:58 +00:00
Richard W.M. Jones
6271c9e2f1 Update to latest gnulib for stable-1.10 branch. 2011-10-31 11:26:54 +00:00
Jim Meyering
0c0f2d6653 bootstrap: use --libtool
(cherry picked from commit 343ba6d482)
2011-10-31 11:26:54 +00:00
Richard W.M. Jones
5ff81f7d6e perl: Add %guestfs_introspection hash with introspection information.
Because this is a useful introspection API, it is a candidate for
being backported into older stable branches.
(cherry picked from commit 365885dab2)
2011-10-31 09:57:22 +00:00
Richard W.M. Jones
6088d6167d Add test for qemu broken -machine option (RHBZ#748266).
Also add this option, if necessary, when testing for virtio-serial
support.

When the workaround is enabled, we specify machine type 'pc'.
(cherry picked from commit 3814680423)
2011-10-31 09:56:58 +00:00
Richard W.M. Jones
0ca7796e94 appliance: udev-174 moves udevd to /lib/udev/udevd (instead of /sbin/udevd)
(cherry picked from commit fef0ff3d86)
2011-10-31 09:54:15 +00:00
Richard W.M. Jones
5346c8f301 Version 1.10.9. 1.10.9 2011-09-16 16:56:23 +01:00
Richard W.M. Jones
25791edff5 Version 1.10.9. 2011-09-16 16:15:37 +01:00
Richard W.M. Jones
7d809dfd42 Add an optional group ("grub") for the guestfs_grub_install API.
This also improves the documentation for this call, pointing out
several pitfalls in using it.

This unfortunately breaks existing callers that might use
guestfs_grub_install without checking for this new group.
(cherry picked from commit 99624d2922)
2011-09-16 16:15:37 +01:00
Richard W.M. Jones
74ea723c82 Remove old regression test that mainly tested a buggy API.
The guestfs_ll command currently lists files in the appliance if you
prefix filenames with "/..".  However this is a bug, not a feature,
and we should not be testing it.
(cherry picked from commit 8ab2b85b2a)
2011-09-16 16:15:37 +01:00
Richard W.M. Jones
852df46b8e daemon: Factor out name of virtio serial channel.
This is just code motion.
(cherry picked from commit 73be6db9bf)
2011-09-16 16:15:37 +01:00
Richard W.M. Jones
4480845ed4 Create /sys directory if it doesn't exist already.
Ubuntu 10.04 LTS packages don't create /sys.
(cherry picked from commit 5b012024c4)
2011-09-16 16:15:37 +01:00
Richard W.M. Jones
8e9e6725b4 ruby: Check Ruby callback exists before we call it (RHBZ#733297).
(cherry picked from commit 1a4f1df77e)
2011-09-16 16:15:36 +01:00
Richard W.M. Jones
88f9599e1f ruby: Use a regular C array to pass the arguments through rb_rescue.
(cherry picked from commit 675f336319)
2011-09-16 16:15:36 +01:00
Richard W.M. Jones
32a8b0f54c ruby: Append newline character after printing exception in callback.
(cherry picked from commit 0cd5b9ac15)
2011-09-16 16:15:36 +01:00
Hilko Bengen
389998923f python: Newer versions want parentheses around arguments of "print"
(cherry picked from commit 54911bdd32)
2011-09-16 16:15:36 +01:00
Richard W.M. Jones
84f4fa6ebc php: Fix bug in PHP tests.
We partitioned the disk, and then tried to create a PV on the whole
disk.  LVM gave the error:

  Device /dev/vda not found (or ignored by filtering).

It is unclear how this bug persisted for so long.  It might be due to
a change in LVM.
(cherry picked from commit 4fb3b23fb6)
2011-09-16 16:15:36 +01:00
Richard W.M. Jones
9671726e2c Coverity: fix memory leak along error path.
(cherry picked from commit ce18be33cd)
2011-09-16 16:15:35 +01:00
Richard W.M. Jones
906bced0d2 Coverity: Initialize msg buffer.
msg_flags was not being initialized and would have been passed to
sendmsg with a random value.
(cherry picked from commit a31ac8fc32)
2011-09-16 16:15:35 +01:00
Richard W.M. Jones
1bfdc3f0b0 Coverity: fix memory leak in guestfish.
(cherry picked from commit c38cb92ec4)
2011-09-16 16:15:35 +01:00
Richard W.M. Jones
8ce64bd62f Coverity: in daemon, free struct in RStruct, RStructList functions.
(cherry picked from commit b2edcbe1b9)
2011-09-16 16:15:35 +01:00
Richard W.M. Jones
68fcbb6f5f pclose: Fix other places where we only tested pclose == -1.
pclose can return > 0 when the status of the command was non-zero.
(cherry picked from commit 631faad971)
2011-09-16 16:15:35 +01:00
Richard W.M. Jones
7e48486589 test_qemu: pclose may return any != 0 on error.
In particular pclose returns a status > 0 if the command fails.
(cherry picked from commit a24652c7b2)
2011-09-16 16:15:34 +01:00
Richard W.M. Jones
d28f8f4cc3 qemu detection: Free up previous qemu help/version strings if they exist.
(cherry picked from commit 2ace9be4cd)
2011-09-16 16:15:34 +01:00
Richard W.M. Jones
8375d3032e Coverity: test_qemu: Ensure FILE * is not leaked along error paths.
This refactors the code in test_qemu slightly to ensure that
FILE *fp is not leaked on error paths.
(cherry picked from commit 08e77ad8cb)
2011-09-16 16:15:30 +01:00
Richard W.M. Jones
e25b7a5e1e Coverity: Check guestfs_inspect_get_product_name() != NULL before using.
(cherry picked from commit fa44536b0f)
2011-09-16 15:48:40 +01:00
Richard W.M. Jones
222b7d35d7 rescue: Ignore errno after guestfs_launch.
errno is pretty much random on the error path back from guestfs_launch
so there is nothing useful to be gained by checking it.

We could do with a better way to detect if appliance launch failed.
(cherry picked from commit 00fef9eed6)
2011-09-16 15:48:36 +01:00
Richard W.M. Jones
3140f96de9 Coverity: Ignore return value from guestfs_launch in virt-rescue.
We expect guestfs_launch to fail in this program.
(cherry picked from commit 9bab154d48)
2011-09-16 15:48:32 +01:00
Richard W.M. Jones
403af82609 Coverity: Check return value from sscanf in bindtests calls.
(cherry picked from commit 4c76aaa391)
2011-09-16 15:48:29 +01:00
Richard W.M. Jones
e86896d6bb configure: Add --with-extra flag to allow setting the extra version string.
Intended use in Fedora and RHEL is to encode the release
string, eg.

  ./configure [...] --with-extra="-%{release}"
(cherry picked from commit a4db75521d)
2011-09-16 15:47:24 +01:00
Richard W.M. Jones
914d1378b2 protocol: Fix case where download can fail for small files.
There is another case where downloads of small files could fail if the
library side (writer) fails.  In this case the library would send back
a cancellation, but it would be received after the daemon had finished
sending the whole file (because the file is small enough).  The daemon
would reenter the main loop and immediately get an unexpected cancel
message, causing the daemon to die.

This commit also makes test-cancellation-download-librarycancels.sh
more robust.  We use Monte-Carlo testing with a range of file sizes.
Small file sizes should trigger the error case.
(cherry picked from commit e4cba8f2b1)
2011-09-16 15:46:12 +01:00
Richard W.M. Jones
3eed1c3fb2 Escape special/non-printing characters in debug output (RHBZ#731744).
The default event handler in libguestfs was simply writing all debug
output directly to stderr.  However if the output contains
non-printable characters such as terminal control codes then these
would also be sent directly.

With newer SeaBIOS there is a lame attempt to implement a splash
screen using terminal control codes, thus when libguestfs tries to
display debugging output it would cause the screen to clear and debug
output to be lost.

This commit causes all non-printing characters to be escaped.
(\n and \r characters from the appliance are treated somewhat
specially).

Furthermore, instead of using write(2), use buffered stderr calls.
(cherry picked from commit 06019bc82e)
2011-09-16 15:46:00 +01:00
Richard W.M. Jones
d944e7758d Vesion 1.10.8. 1.10.8 2011-08-17 14:05:32 +01:00
Richard W.M. Jones
72aef55ec3 ruby: Fix typo in Ruby bindings file.
(cherry picked from commit 44c3a30026)
2011-08-17 13:05:23 +01:00
Richard W.M. Jones
b2aa2ef621 Note that additional memory may be required to typecheck Augeas lenses (RHBZ#729887).
(cherry picked from commit 7739d7f471)
2011-08-17 13:05:23 +01:00
Richard W.M. Jones
7f35002e23 fish: Document that remote run in cmd substitution context hangs.
This documents bug 592910.
(cherry picked from commit 6cabc1cd02)
2011-08-17 13:05:23 +01:00
Richard W.M. Jones
1ba3852b75 Fix 'unknown filesystem' warnings in old inspection code (RHBZ#678231 RHBZ#666578).
This is a comprehensive fix for the warnings from the old (and
obsolete) Perl inspection code.  For a full description and
reproducer, see:

https://bugzilla.redhat.com/show_bug.cgi?id=678231#c5
(cherry picked from commit b983800101)
2011-08-17 13:05:23 +01:00
Richard W.M. Jones
f5036236ff inspection: Better checking for Windows root disks (RHBZ#729075).
Previously any disk that had /autoexec.bat or /boot.ini or /ntldr
would be picked up as a candidate for a Windows root disk.  If further
checking could not find any systemroot (eg. /windows) then this would
result in complete failure of inspection.

In particular, this got confused by Hp_recovery partitions which have
/autoexec.bat, but don't have a systemroot in one of the usual places
(they have /MiniNT instead).

What we do now is to properly investigate all possible systemroot
places before deciding this is a Windows systemroot, so the subsequent
failure cannot occur.

(Thanks to lorimar for reporting this bug).

Cherry picked from commit 2c57305f72
and backported to stable-1.10 branch.
2011-08-17 13:05:22 +01:00
Richard W.M. Jones
1f980d1b10 build: Set TMPDIR for local testing.
This avoids conflicts with the globally installed libguestfs
appliance, or lets us build in multiple local directories at the same
time without conflicts.

Cherry picked from commit f7d18c84dd
and backported to stable-1.10 branch.
2011-08-17 13:05:22 +01:00
Richard W.M. Jones
a2a899215a fish: Add fish-cmds.h to generator_built.
This updates commit 3064277680.
(cherry picked from commit 85efbc6aa7)
2011-08-17 13:05:22 +01:00
Richard W.M. Jones
2fb83cc8ed fish: Declare run_* functions in a generated header file.
Calls to these functions are generated, so there is no need to declare
the functions by hand.

Cherry picked from commit 3064277680
and backported to stable-1.10 branch.
2011-08-17 12:31:38 +01:00
Richard W.M. Jones
50e5821f46 Version 1.10.7. 1.10.7 2011-08-07 23:20:28 +01:00
Richard W.M. Jones
340a13f991 docs: Fix function names in deprecation notices.
(cherry picked from commit 60adf092a8)
2011-08-07 22:00:50 +01:00
Richard W.M. Jones
a41040be6f docs: guestfs_set_out_of_memory_handler returns void, not int.
It always has done.  The documentation was wrong.
(cherry picked from commit 70f44cc0ea)
2011-08-07 22:00:40 +01:00