Commit Graph

3409 Commits

Author SHA1 Message Date
Richard W.M. Jones
d8a1389df3 tools: Mark obsolete tools clearly in the man pages. 2012-01-18 21:15:37 +00:00
Richard W.M. Jones
b9b77e7014 Version 1.15.17. 1.15.17 2012-01-18 17:21:09 +00:00
Richard W.M. Jones
535977bff8 lib: Use -fvisibilty=hidden by default; only ABI symbols are now visible.
http://gcc.gnu.org/wiki/Visibility
2012-01-18 17:21:08 +00:00
Richard W.M. Jones
8b9eaec993 ocaml: Use automake to build the C part of the bindings.
By arranging the C part of the bindings into a library, we can get
automake to build it instead of using $(CC) directly.
2012-01-18 17:21:04 +00:00
Richard W.M. Jones
607784df92 ocaml: Don't include guestfs-internal.h directly.
However since the OCaml bindings use guestfs_safe_strdup and
guestfs_safe_memdup we need to export those two (in the private
functions section) from <guestfs.h>.
2012-01-18 16:28:31 +00:00
Richard W.M. Jones
db90770ec5 ocaml: Add -Wno-missing-field-initializers to avoid a warning. 2012-01-18 16:28:31 +00:00
Richard W.M. Jones
6de1a1242e New tool: virt-format: erase and make blank disks.
This tool allows you to easily reformat a disk, creating a blank disk
with optional partition, LVM and empty filesystem.
2012-01-18 16:28:31 +00:00
Richard W.M. Jones
dd0707be5f fish options parsing: Allow add_drives to be called multiple times.
Ensure that the drv structure is always zeroed on allocation.

Don't leak old drv->device when add_drives is called multiple times.
2012-01-18 16:28:10 +00:00
Matthew Booth
fd1a6d8003 c: Allow NULL optargs to be passed to _argv calls
Previously, passing NULL optargs to an _argv call resulted in a segfault. This
change causes NULL optargs to be interpreted as no optargs, and to be correctly
handled accordingly.
2012-01-17 15:37:14 +00:00
Matthew Booth
c7119da130 c: NFC Remove redundant parentheses 2012-01-17 15:37:14 +00:00
Matthew Booth
3b352de1e9 generator: Add an explicit Cancellable flag
Currently any api which takes a FileIn or FileOut parameter is implicitly
cancellable. This change make cancellable an explicit flag in anticipation of it
being added to other apis.

Note that a Cancellable function must be able to return an error, which means it
can't return RConstOptString.
2012-01-17 15:37:14 +00:00
Matthew Booth
83c20f02dc generator: Add CamelName flag
We can make a good guess at camel case names for most APIs. For example,
add_drive_opts can be automatically transformed to AddDriveOpts. However, other
apis don't produce a satisfactory name when transformed automatically. For
example, we would want md_create to produce MDCreate rather than MdCreate.

This change adds a CamelName flag which allows a camel case name to be specified
explicitly when the automatic transformation isn't satisfactory.
2012-01-17 15:37:14 +00:00
Richard W.M. Jones
b1ea8a7808 resize2fs-M: fix double-free along error path (thanks Matthew Booth). 2012-01-16 10:15:02 +00:00
Richard W.M. Jones
3e9f8d050a e2fsck: Tidy up the documentation for this API. 2012-01-16 10:14:38 +00:00
Wanlong Gao
4ac5e2d218 e2fsck-f: change the internal to use e2fsck
Since we implement the new api e2fsck, just change the
internal of e2fsck_f to use e2fsck now.
v1->v2: use optargs_bitmask

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2012-01-13 16:48:23 +00:00
Wanlong Gao
38a0966da8 NEW API: add a new api e2fsck
m: Wanlong Gao <gaowanlong@cn.fujitsu.com>

Add a new api e2fsck with two options:
correct: same as '-p' option of e2fsck
forceall: same as '-y' option of e2fsck

Thanks for Rich's idea.
v1->v2: use optargs_bitmask
v2->v3: change the optargs_bitmask check

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2012-01-13 16:48:22 +00:00
Wanlong Gao
0eaf06e673 ext2: tweak the error returned message of resize2fs-M(BZ755729)
Tweak the error message "e2fsck -f" and "e2fsck -fy".
Indicate the user to use the correct and/or forceall options.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2012-01-13 16:48:20 +00:00
Matthew Booth
f6db1ec410 build: Remove .depend files from git
Remove generated .depend files from source control, and don't barf when they
don't exist while bootstrapping.
2012-01-11 16:00:00 +00:00
Richard W.M. Jones
9fde0fad08 Update RELEASE-NOTES. 2012-01-11 14:05:29 +00:00
Richard W.M. Jones
54a7982dc3 extra-tests: Only test 5 random guests.
If you have a lot of guests, running extra tests takes a lot of time,
but (arguably) you're not really doing any more detailed testing.

Thus pick up to 5 guests at random to test.  A different random
selection is done on each run, ensuring that data-driven errors (eg in
inspection) will still be found eventually.
2012-01-10 18:52:53 +00:00
Richard W.M. Jones
adb0050d86 Version 1.15.16. 1.15.16 2012-01-10 17:52:05 +00:00
Richard W.M. Jones
39a10c9fab Allow /dev/null to be added multiple times.
Change the test for duplicate drives so that you're allowed to
add /dev/null multiple times.  This corresponds to traditional
usage.

This amends commit be47b66c30.
2012-01-10 16:51:36 +00:00
Richard W.M. Jones
01e717b3c1 daemon: debug segv correct use of dereferencing NULL. 2012-01-09 16:55:49 +00:00
Wanlong Gao
e0c3093795 launch: move the filename checking to a wrapper
Move the filename's comma character checking to a wrapper.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2012-01-09 14:08:41 +00:00
Wanlong Gao
be47b66c30 launch: don't add a drive twice
1. Change the g->path to restore a absolute path instead of the mixed.
2. Check that if the adding drive is duplicated with the added drive.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>

RWMJ:

- Make sure abs_path is NULL before it is assigned, so freeing it
  will work along the error path.

- Fix the test which added /dev/null multiple times.
2012-01-09 14:08:26 +00:00
Matthew Booth
0a7b734d2f generator: Create a separate type for optional arguments
Previously, optional arguments had the same type as regular arguments, but were
constrained by various runtime tests to be only Bool, Int, Int64 or String. This
change makes the type of optional arguments stronger by giving them their own
type.

A convenience function, optargs_to_args is defined to convert optargs in the few
places where they are genuinely treated identically to mandatory arguments.

It also allows for future changes to optional arguments which do not affect
mandatory arguments.

RWMJ:
 - removed redundant parens
 - readded the check for > 64 optargs, but changed it to > 63
 - changed the new function to args_of_optargs
2012-01-09 13:30:34 +00:00
Matthew Booth
e24af214fe generator: Rename java_structs to camel_structs to better reflect their purpose
This map was originally included just for the java bindings, but is generally
useful to any binding which uses camel case by requirement or convention.
2012-01-09 10:34:19 +00:00
Wanlong Gao
6f6485ec34 launch: add a goto label when add_drive error
Code cleanup.
Add a goto label to simplify the code.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2012-01-09 10:23:18 +00:00
Richard W.M. Jones
da13c1c0e6 Version 1.15.15. 1.15.15 2012-01-08 19:12:46 +00:00
Richard W.M. Jones
49b894599b debian: Add build-dep erlang-dev. 2012-01-06 21:08:25 +00:00
Richard W.M. Jones
c51caebea2 Update to latest gnulib. 2012-01-06 18:44:41 +00:00
Matthew Booth
ebdda911b5 Tempora mutantur, nos et mutamur in illis. 2012-01-04 12:32:35 +00:00
Matthew Booth
c655415dc0 build: Fix automake warnings 2012-01-04 10:38:44 +00:00
Richard W.M. Jones
8824089477 Sort .gitignore (using sort -d -- dictionary order). 2012-01-04 10:16:29 +00:00
Wanlong Gao
8af6237fd6 gitignore: ignore the git related files
*.eml for email picked patches
other for orginal git patch related files.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2012-01-04 10:14:41 +00:00
Wanlong Gao
f49a30eba8 fish: fix the Ctrl-\ causes guestfish to abort bug(RHBZ#596761)
Handle SIGQUIT by guestfish, so that it can't be terminated.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2012-01-04 10:04:15 +00:00
Wanlong Gao
10df9d88ab AUTHORS: add the email address for each authors
Add the email address for authors.
It would be better.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2012-01-03 15:45:32 +00:00
Richard W.M. Jones
49218ae6b4 fish: mount can be used instead of mount-options with libguestfs >= 1.14 2011-12-23 22:30:29 +00:00
Richard W.M. Jones
871e1cfe3a fish: Fix --format parameter in man page. 2011-12-23 22:30:09 +00:00
Richard W.M. Jones
03d052d578 Version 1.15.14. 1.15.14 2011-12-23 13:26:31 +00:00
Richard W.M. Jones
6032da6681 lib: Try harder to remove temporary directory along error paths (RHBZ#769680). 2011-12-23 10:37:04 +00:00
Richard W.M. Jones
690ff694ca lib: Add guestfs___remove_tmpdir helper function.
This function does 'rm -rf <dir>' for temporary directories, safely
working if '<dir>' contains shell meta-characters.

Replace existing code for removing directories with this.
2011-12-23 10:35:34 +00:00
Wanlong Gao
486cafd4ac gitignore: ignore the guestfs.* directory
Let git ignore the guestfs.* directorys.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2011-12-23 08:34:14 +00:00
Wanlong Gao
87e03fd48e extra-tests: add test-guests to prevent test error
extra-tests is depending on tests-guests.
We need guests/*.img when doing extra-tests.

/work/git/libguestfs/run valgrind --log-file=/work/git/libguestfs/tests/extra/valgrind.log --leak-check=full --error-exitcode=119 --suppressions=/work/git/libguestfs/tests/extra/suppressions ../../cat/virt-cat -a ../guests/fedora.img /etc/fstab >/dev/null
../guests/fedora.img: No such file or directory
make[1]: *** [test-tools-internal] Error 1
make[1]: Leaving directory `/work/git/libguestfs/tests/extra'

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2011-12-23 08:32:10 +00:00
Richard W.M. Jones
b5f9079302 fish: Fix test-guestfish-events.sh so it works when LIBGUESTFS_DEBUG=1 is set.
Various messages were added and changed when this variable was set
while tests were running.
2011-12-23 08:28:26 +00:00
Wanlong Gao
2ac869bcc8 mkfs: optimization and code cleanup
v1->v2: fix a typo pointed by Matt

Optimizations by reducing the STREQ operations and do some
code cleanup.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>

RWMJ: Whitespace changes.
2011-12-23 08:19:47 +00:00
Richard W.M. Jones
6067e1540f tests/lvm: Contains a Perl test so we must set PERL5LIB.
This fixes commit 498758faee.
2011-12-22 22:17:17 +00:00
Richard W.M. Jones
37aba887d7 tests/protocol: Contains a Perl test so we must set PERL5LIB.
This fixes commit 498758faee.
2011-12-22 19:12:14 +00:00
Richard W.M. Jones
76044a5c00 Version 1.15.13. 1.15.13 2011-12-22 18:34:22 +00:00
Richard W.M. Jones
9a5f784d51 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>
2011-12-22 18:12:48 +00:00