Commit Graph

11557 Commits

Author SHA1 Message Date
Richard W.M. Jones
68a02c2f6c customize, resize, sparsify, sysprep: Link explicitly with pthread
Cherry picked from guestfs-tools commit 87543dad61.
2021-09-11 09:42:12 +01:00
Richard W.M. Jones
489b14b75e ocaml/examples: Link examples to gnulib
It's unclear why exactly the OCaml library is using replacement
symbols, but it is so we need gnulib.  Note this only applies in the
stable-1.44 branch since upstream we have finally got rid of gnulib,
because of exactly these kinds of problems that it causes everyone.

ocamlfind ocamlopt -cclib -L../../lib/.libs -package unix -linkpkg \
          -warn-error A -I .. mlguestfs.cmxa create_disk.ml -o create_disk
../libmlguestfs.a(libguestfsocaml_a-guestfs-c.o): In function `guestfs_finalize':
/home/rjones/d/libguestfs-1.44/ocaml/guestfs-c.c:86: undefined reference to `rpl_free'
/home/rjones/d/libguestfs-1.44/ocaml/guestfs-c.c:88: undefined reference to `rpl_free'
../libmlguestfs.a(libguestfsocaml_a-guestfs-c.o): In function `guestfs_int_ocaml_set_event_callback':
/home/rjones/d/libguestfs-1.44/ocaml/guestfs-c.c:239: undefined reference to `rpl_free'
../libmlguestfs.a(libguestfsocaml_a-guestfs-c.o): In function `guestfs_int_ocaml_delete_event_callback':
/home/rjones/d/libguestfs-1.44/ocaml/guestfs-c.c:266: undefined reference to `rpl_free'
../libmlguestfs.a(libguestfsocaml_a-guestfs-c.o): In function `guestfs_int_ocaml_event_to_string':
/home/rjones/d/libguestfs-1.44/ocaml/guestfs-c.c:290: undefined reference to `rpl_free'
../libmlguestfs.a(libguestfsocaml_a-guestfs-c-actions.o):/home/rjones/d/libguestfs-1.44/ocaml/guestfs-c-actions.c:1188: more undefined references to `rpl_free' follow
collect2: error: ld returned 1 exit status
File "caml_startup", line 1:
Error: Error during linking
make[2]: *** [Makefile:2272: create_disk] Error 2
2021-09-11 09:36:08 +01:00
Richard W.M. Jones
e26cfa445a daemon: Build with -pthread
The daemon failed to link with glibc < 2.34 because we didn't include
the separate pthread library.  Adding -pthread fixes this.

Note this change was also make upstream in commit 733d2182b6 ("Remove
the tools.") although I think either by accident or unrelated.

Reported-by: Toolybird
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2003326
2021-09-11 09:27:17 +01:00
Richard W.M. Jones
8be9fb08f8 Version 1.44.2. v1.44.2 2021-09-07 20:03:05 +01:00
Richard W.M. Jones
1f0e713ecf builder: Suppress more bogus -fanalyzer warnings 2021-09-07 17:26:15 +01:00
Richard W.M. Jones
7f0ad95221 rescue: Ignore -Wnull-dereference
This appears somewhere in virt-rescue, unclear from where:

make[2]: Entering directory '/home/rjones/d/libguestfs-1.44/rescue'
  CC       virt_rescue-suggest.o
  CCLD     virt-rescue
rescue.c: In function 'main':
../common/utils/stringlists-utils.c:54:19: error: potential null pointer dereference [-Werror=null-dereference]
   54 |   for (r = 0; argv[r]; ++r)
      |                   ^
../common/utils/stringlists-utils.c:54:19: error: potential null pointer dereference [-Werror=null-dereference]
lto1: all warnings being treated as errors
2021-09-07 17:00:38 +01:00
Richard W.M. Jones
4695918995 daemon: Disable -Wstack-usage warning
When using LTO, inlining something (I'm unclear what exactly) causes
these errors:

stubs-1.c: In function 'md_create_stub':
stubs-1.c:1929:1: error: stack usage might be unbounded [-Werror=stack-usage=]
 1929 | md_create_stub (XDR *xdr_in)
      | ^
stubs-0.c: In function 'mkfs_btrfs_stub':
stubs-0.c:1984:1: error: stack usage might be unbounded [-Werror=stack-usage=]
 1984 | mkfs_btrfs_stub (XDR *xdr_in)
      | ^
stubs-3.c: In function 'btrfs_device_delete_stub':
stubs-3.c:477:1: error: stack usage might be unbounded [-Werror=stack-usage=]
  477 | btrfs_device_delete_stub (XDR *xdr_in)
      | ^
stubs-3.c: In function 'btrfs_image_stub':
stubs-3.c:694:1: error: stack usage might be unbounded [-Werror=stack-usage=]
  694 | btrfs_image_stub (XDR *xdr_in)
      | ^
stubs-5.c: In function 'btrfs_device_add_stub':
stubs-5.c:247:1: error: stack usage might be unbounded [-Werror=stack-usage=]
  247 | btrfs_device_add_stub (XDR *xdr_in)
      | ^

Note this is only for the stable branch.
2021-09-07 17:00:38 +01:00
Richard W.M. Jones
704e84f213 daemon/xfs.c: Ignore bogus warnings from -fanalyzer
Lots of variations of this.  It cannot happen because we check that
section != NULL just before calling this code.

                'parse_xfs_info': event 41
                  |
                  |../lib/guestfs-internal-all.h:50:21:
                  |   50 | #define STREQ(a,b) (strcmp((a),(b)) == 0)
                  |      |                     ^~~~~~~~~~~~~~~
                  |      |                     |
                  |      |                     (41) argument 1 ('section') from (35) could be NULL where non-null expected
xfs.c:186:13: note: in expansion of macro 'STREQ'
                  |  186 |         if (STREQ (section, "meta-data")) {
                  |      |             ^~~~~
                  |

Similarly this error does not appear possible:

xfs.c:154:7: error: double-'free' of 'ret_9' [CWE-415] [-Werror=analyzer-double-free]
  154 |       free (section);
      |       ^

See comment for why these suppressions are placed centrally.
2021-09-07 17:00:38 +01:00
Richard W.M. Jones
a252ed5feb lib/launch-libvirt.c: Fix type of outlen parameter of base64_decode_alloc_ctx
In file included from launch-libvirt.c:49:
launch-libvirt.c: In function 'add_secret':
launch-libvirt.c:1956:54: error: pointer targets in passing argument 5 of 'base64_decode_alloc_ctx' differ in signedness [-Werror=pointer-sign]
 1956 |                               (char **) &secret_raw, &secret_raw_len)) {
      |                                                      ^~~~~~~~~~~~~~~
      |                                                      |
      |                                                      size_t * {aka long unsigned int *}
../gnulib/lib/base64.h:62:56: note: in definition of macro 'base64_decode_alloc'
   62 |         base64_decode_alloc_ctx (NULL, in, inlen, out, outlen)
      |                                                        ^~~~~~
../gnulib/lib/base64.h:56:57: note: expected 'idx_t *' {aka 'long int *'} but argument is of type 'size_t *' {aka 'long unsigned int *'}
   56 |                                      char **out, idx_t *outlen);
      |                                                  ~~~~~~~^~~~~~
cc1: all warnings being treated as errors

Note this patch is only required in the stable branch because
of the gnulib update.
2021-09-07 17:00:38 +01:00
Richard W.M. Jones
64a11a274b Update gnulib to latest
Note we do not use gnulib in libguestfs any more, so this update only
applies to the stable branch.
2021-09-07 17:00:38 +01:00
Richard W.M. Jones
21c44b1ee9 Update common to latest. 2021-09-07 17:00:38 +01:00
Richard W.M. Jones
41760ea81e python, java: Avoid bogus -fanalyzer warnings
This is essentially the same as the previous OCaml commit.  It does
not fix a real bug.

(cherry picked from commit ceb034c92c)
2021-09-07 17:00:38 +01:00
Richard W.M. Jones
a647bec32a ocaml/guestfs-c.c: Avoid bogus -fanalyzer warning
This warning is bogus, caused by the analyzer cannot track that len ==
0 if roots == NULL.  I just changed the code to make it easier to
analyze, this doesn't fix any real bug.

guestfs-c.c: In function 'guestfs_finalize':
guestfs-c.c:85:9: error: dereference of NULL '0B' [CWE-476] [-Werror=analyzer-null-dereference]
   85 |         caml_remove_generational_global_root (roots[i]);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

(cherry picked from commit ea04d6b878)
2021-09-07 17:00:38 +01:00
Richard W.M. Jones
084e4890af daemon/utils.c: Fix potential unbounded stack usage
utils.c: In function 'prog_exists':
utils.c:650:1: error: stack usage might be unbounded [-Werror=stack-usage=]
  650 | prog_exists (const char *prog)
      | ^

(cherry picked from commit a7245fba7a)
2021-09-07 16:13:13 +01:00
Richard W.M. Jones
f01818fb00 daemon/xattr.c: Increase size of temporary buffer for %zu
Found by GCC -fanalyzer:

xattr.c:478:32: error: '%zu' directive output may be truncated writing between 1 and 19 bytes into a region of size 16 [-Werror=format-truncation=]
  478 |     snprintf (num, sizeof num, "%zu", nr_attrs);
      |                                ^
xattr.c:478:32: note: directive argument in the range [0, 2305843009213693950]
/usr/include/bits/stdio2.h:71:10: note: '__builtin___snprintf_chk' output between 2 and 20 bytes into a destination of size 16
   71 |   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
      |          ^

(cherry picked from commit 58599031f8)
2021-09-07 16:13:13 +01:00
Richard W.M. Jones
1e131ea01a daemon/luks.c: Ignore bogus GCC -fanalyzer double-free warning
As far as I can tell the analysis is completely bogus.  We don't
double-free the tempfile string in do_luks_add_key.  Therefore add a
GCC suppression around the remove_temp function.

luks.c: In function 'do_luks_add_key':
luks.c:84:3: error: double-'free' of 'tempfile_14' [CWE-415] [-Werror=analyzer-double-free]
   84 |   free (tempfile);
      |   ^~~~~~~~~~~~~~~
  'do_luks_add_key': events 1-2
    |
    |  143 | do_luks_add_key (const char *device, const char *key, const char *newkey,
    |      | ^~~~~~~~~~~~~~~
    |      | |
    |      | (1) entry to 'do_luks_add_key'
    |......
    |  146 |   char *keyfile = write_key_to_temp (key);
    |      |                   ~~~~~~~~~~~~~~~~~~~~~~~
    |      |                   |
    |      |                   (2) calling 'write_key_to_temp' from 'do_luks_add_key'
    |
    +--> 'write_key_to_temp': events 3-12
           |
           |   41 | write_key_to_temp (const char *key)
           |      | ^~~~~~~~~~~~~~~~~
           |      | |
           |      | (3) entry to 'write_key_to_temp'
           |......
           |   47 |   tempfile = strdup ("/tmp/luksXXXXXX");
           |      |              ~~~~~~~~~~~~~~~~~~~~~~~~~~
           |      |              |
           |      |              (4) allocated here
           |   48 |   if (!tempfile) {
           |      |      ~
           |      |      |
           |      |      (5) assuming 'tempfile_14' is non-NULL
           |      |      (6) following 'false' branch (when 'tempfile_14' is non-NULL)...
           |......
           |   53 |   fd = mkstemp (tempfile);
           |      |   ~~
           |      |   |
           |      |   (7) ...to here
           |   54 |   if (fd == -1) {
           |      |      ~
           |      |      |
           |      |      (8) following 'false' branch...
           |......
           |   59 |   len = strlen (key);
           |      |   ~~~
           |      |   |
           |      |   (9) ...to here
           |   60 |   if (xwrite (fd, key, len) == -1) {
           |      |      ~
           |      |      |
           |      |      (10) following 'false' branch...
           |......
           |   66 |   if (close (fd) == -1) {
           |      |   ~~ ~
           |      |   |  |
           |      |   |  (12) following 'false' branch...
           |      |   (11) ...to here
           |
         'write_key_to_temp': event 13
           |
           |cc1:
           | (13): ...to here
           |
    <------+
    |
  'do_luks_add_key': events 14-17
    |
    |  146 |   char *keyfile = write_key_to_temp (key);
    |      |                   ^~~~~~~~~~~~~~~~~~~~~~~
    |      |                   |
    |      |                   (14) returning to 'do_luks_add_key' from 'write_key_to_temp'
    |  147 |   if (!keyfile)
    |      |      ~
    |      |      |
    |      |      (15) following 'false' branch...
    |......
    |  150 |   char *newkeyfile = write_key_to_temp (newkey);
    |      |   ~~~~               ~~~~~~~~~~~~~~~~~~~~~~~~~~
    |      |   |                  |
    |      |   |                  (17) calling 'write_key_to_temp' from 'do_luks_add_key'
    |      |   (16) ...to here
    |
    +--> 'write_key_to_temp': events 18-26
           |
           |   41 | write_key_to_temp (const char *key)
           |      | ^~~~~~~~~~~~~~~~~
           |      | |
           |      | (18) entry to 'write_key_to_temp'
           |......
           |   47 |   tempfile = strdup ("/tmp/luksXXXXXX");
           |      |              ~~~~~~~~~~~~~~~~~~~~~~~~~~
           |      |              |
           |      |              (19) allocated here
           |   48 |   if (!tempfile) {
           |      |      ~
           |      |      |
           |      |      (20) following 'false' branch (when 'tempfile_14' is non-NULL)...
           |......
           |   53 |   fd = mkstemp (tempfile);
           |      |   ~~
           |      |   |
           |      |   (21) ...to here
           |   54 |   if (fd == -1) {
           |      |      ~
           |      |      |
           |      |      (22) following 'false' branch...
           |......
           |   59 |   len = strlen (key);
           |      |   ~~~
           |      |   |
           |      |   (23) ...to here
           |   60 |   if (xwrite (fd, key, len) == -1) {
           |      |      ~
           |      |      |
           |      |      (24) following 'false' branch...
           |......
           |   66 |   if (close (fd) == -1) {
           |      |   ~~ ~
           |      |   |  |
           |      |   |  (26) following 'false' branch...
           |      |   (25) ...to here
           |
         'write_key_to_temp': event 27
           |
           |cc1:
           | (27): ...to here
           |
    <------+
    |
  'do_luks_add_key': events 28-32
    |
    |   84 |   free (tempfile);
    |      |   ~~~~~~~~~~~~~~~
    |      |   |
    |      |   (31) first 'free' here
    |      |   (32) second 'free' here; first 'free' was at (31)
    |......
    |  150 |   char *newkeyfile = write_key_to_temp (newkey);
    |      |                      ^~~~~~~~~~~~~~~~~~~~~~~~~~
    |      |                      |
    |      |                      (28) returning to 'do_luks_add_key' from 'write_key_to_temp'
    |  151 |   if (!newkeyfile) {
    |      |      ~
    |      |      |
    |      |      (29) following 'false' branch...
    |......
    |  156 |   const char *argv[MAX_ARGS];
    |      |   ~~~~~
    |      |   |
    |      |   (30) ...to here
    |
cc1: all warnings being treated as errors

(cherry picked from commit d00c36410b)
2021-09-07 16:13:13 +01:00
Richard W.M. Jones
ea048d513d daemon/inotify.c: Clean up error handling
In particular avoid calling fclose on a popen'd handle.

Error identified by GCC -fanalyzer.

(cherry picked from commit 8dd09a16f5)
2021-09-07 16:13:13 +01:00
Richard W.M. Jones
5da303bde8 m4/guestfs-appliance.m4: Add support for Alma and Cloud Linux
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2001636
Thanks: sasha121196@mail.ru
(cherry picked from commit 4e02c13941)
2021-09-07 16:12:06 +01:00
Richard W.M. Jones
bb08b4d62a appliance: Add mount package for Debian
https://listman.redhat.com/archives/libguestfs/2021-September/msg00013.html

Reported-by: Joerg Schiermeier
(cherry picked from commit ae7187af94)
2021-09-07 16:12:06 +01:00
Laszlo Ersek
15364c3ff4 tests/mount-local: exit child immediately when exec fails
Each worker thread of "test-parallel-mount-local" performs the following
steps (among others):

(1) it starts an appliance dedicated to that thread, using a private
    scratch disk image,

(2) exports a dedicated FUSE mount point on the host, exposing the file
    system on the appliance's disk,

(3) launches a child process for manipulating the particular FUSE mount
    point on the host,

(4) enters a FUSE request processing loop, translating requests between
    the host kernel (coming in via the FUSE mount point) and the
    appliance.

Items to note:

- The child process from step (3) consists of a single thread of execution
  (see fork() in POSIX): a duplicate of the parent process's respective
  worker thread.

- The child process from step (3) blocks on any FUSE mount point access on
  the host until the worker thread in the parent process starts processing
  FUSE requests, in step (4).

- The FUSE request processing in step (4), in the worker thread living in
  the parent process, terminates if and only if the child process unmounts
  the FUSE mount point originating from (2).

Should the exec call in step (3) fail for any reason, the child currently
jumps to the "error" label. This is wrong: under the error label, we call
guestfs_close() on the appliance -- but the appliance is owned by the
parent process's worker thread, not the child. What happens is that the
child kills off the appliance while the parent's worker thread is in the
FUSE request processing loop (4).

The "error" label was never meant to be reached by the child process -- if
exec fails for any reason, exit the child immediately. The parent will
remain in the FUSE request processing loop (4) forever, but no state will
be corrupted. For example, using another (interactive) session on the
host, the FUSE mount points can be interacted with, and if all of them are
manually unmounted, the FUSE request processing (4) completes in every
worker thread.

This patch does not fix the primary issue with
"test-parallel-mount-local", but removes "chaos" from the symptoms. The
next patch will fix the actual regression in this test case.

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20210902135124.15191-2-lersek@redhat.com>
Acked-by: Richard W.M. Jones <rjones@redhat.com>
(cherry picked from commit 79d7fc8674)
2021-09-07 16:12:06 +01:00
Hilko Bengen
2215928f9a appliance: Fix searching for shared libraries on usr-merged Debian systems
If /lib is a symlink to usr/lib, paths to shared libraries as
determined by ld.so may differ from dpkg's file lists.

We turn the filename search pattern into a glob expression by
prefixing it with a '*', so the required packages are found again:

$ dpkg -S /lib/x86_64-linux-gnu/libpcre2-8.so.0
dpkg-query: no path found matching pattern /lib/x86_64-linux-gnu/libpcre2-8.so.0
$ dpkg -S */lib/x86_64-linux-gnu/libpcre2-8.so.0
libpcre2-8-0:amd64: /usr/lib/x86_64-linux-gnu/libpcre2-8.so.0

(cherry picked from commit 39f514b28d)
2021-09-07 16:12:06 +01:00
Richard W.M. Jones
3dc3b7bc7f lib: Autodetect backing format for qemu-img create -b
qemu 6.1 has decided to change qemu-img create so that a backing
format (-F) is required if a backing file (-b) is specified.  Since we
don't want to change the libguestfs API to force callers to specify
this because that would be an API break, autodetect it.

This is similar to commit c8c181e8d9 ("launch: libvirt: Autodetect
backing format for readonly drive overlays").

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1998820
(cherry picked from commit 45de287447)
2021-09-07 16:12:06 +01:00
Alexandre Iooss
3950979b8f build: Define HAVE_RPM, HAVE_DPKG and HAVE_PACMAN
When using option `--with-distro`, `HAVE_RPM`, `HAVE_DPKG` and
`HAVE_PACMAN` are not defined and make the configure phase fail.
This makes sure that these conditionals are always defined.

(cherry picked from commit 210959cc34)
2021-09-07 16:12:06 +01:00
Richard W.M. Jones
354b6ad87c lib: Add osinfo information for Windows Server 2022 Datacenter
Windows Server 2022 preview is identified as <osinfo>win2k16</osinfo>.
Although current osinfo-db does not have an entry "win2k22", return
this instead.

osinfo-db issue to add win2k22:
https://gitlab.com/libosinfo/osinfo-db/-/issues/82

Inspection information for the guest:

    type: windows
    distro: windows
    product_name: Windows Server 2022 Datacenter
    product_variant: Server
    version: 10.0
    arch: x86_64

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1997446
Reported-by: Yongkui Guo
(cherry picked from commit 73cd0a0c8d)
2021-09-07 16:12:06 +01:00
Heinrich Schuchardt
486df4b4e3 launch: board model for RISC-V
On RISC-V there is no default machine type. Invoking QEMU requires to
specify a board model with the -M option. So let's define MACHINE_TYPE
as virt.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
(cherry picked from commit efb3d01992)
2021-09-07 16:12:06 +01:00
Richard W.M. Jones
9a13faf1d6 appliance: Add IBM850 iconv converter for syslinux
$ guestfish -N fs:vfat:2G syslinux /dev/sda1
libguestfs: error: syslinux: Error converting to codepage 850 Invalid argument
...

This happens because of the default codepage requested by syslinux
(code page 850) combined with the appliance missing the iconv
converter for this codepage.

Reported-by: Yongkui Guo
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1990720
(cherry picked from commit 90a076fe19)
2021-09-07 16:12:06 +01:00
Richard W.M. Jones
fae38a8ec5 python: Don't leak fields when creating Python structs
When creating and returning a Python struct we were adding fields from
the C struct, but did not reduce the ref count on the temporary value
after it had been moved to the struct, resulting in a memory leak.

Reported-by: 朱丹 <zhudan24@huawei.com>
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1985912
(cherry picked from commit e84c63a2ca)
2021-09-07 16:12:06 +01:00
Martin Kletzander
88b9cf3a9c build: Don't use non-POSIX tests
The `test` builtin/binary usually accepts `==` for string comparison, it is
mostly accepted for typos and people being used to double equals, but is not
documented and not always accepted either.  Since autoconf uses the default
shell, it might just fail in some cases with:

    ./configure: 29986: test: xrustc: unexpected operator
    ./configure: 29990: test: xcargo: unexpected operator

Just change it to single equals as it is done everywhere else.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit e68a844eb4)
2021-09-07 16:12:06 +01:00
Richard W.M. Jones
552732945e test-data: Replace deprecated luks_open with cryptsetup_open.
The two calls are identical, so this simply avoids a deprecation
warning.

(cherry picked from commit 0b223a2877)
2021-09-07 16:12:06 +01:00
Daniel P. Berrangé
37f13a6e0d point users to Libera Chat rather than FreeNode
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
(cherry picked from commit 5e98999b1f)
2021-09-07 16:12:06 +01:00
Richard W.M. Jones
021a1e8432 rust: Fix deprecated use of panic!(format!(...))
warning: panic message is not a string literal
 --> src/bin/event_leak.rs:9:30
  |
9 |             Err(e) => panic!(format!(" could not create handle {:?}", e)),
  |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(non_fmt_panic)]` on by default
  = note: this is no longer accepted in Rust 2021
  = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

(cherry picked from commit d01ce08218)
2021-09-07 16:12:06 +01:00
Richard W.M. Jones
5c8430d52d lib: qemu: Don't use -enable-fips option.
QEMU has deprecated this option:

    commit 166310299a1e7824bbff17e1f016659d18b4a559
    Author: Daniel P. Berrangé
    Date:   Tue Oct 20 17:08:27 2020 +0100

    os: deprecate the -enable-fips option and QEMU's FIPS enforcement

    The -enable-fips option was added a long time ago to prevent the use of
    single DES when VNC when FIPS mode is enabled. It should never have been
    added, because apps are supposed to unconditionally honour FIPS mode
    based on the '/proc/sys/crypto/fips_enabled' file contents.

    In addition there is more to achieving FIPS compliance than merely
    blocking use of certain algorithms. Those algorithms which are used
    need to perform self-tests at runtime.

    QEMU's built-in cryptography provider has no support for self-tests,
    and neither does the nettle library.

    If QEMU is required to be used in a FIPS enabled host, then it must be
    built with the libgcrypt library enabled, which will unconditionally
    enforce FIPS compliance in any algorithm usage.

    Thus there is no need to keep either the -enable-fips option in QEMU, or
    QEMU's internal FIPS checking methods.

(cherry picked from commit d3bbc02190)
2021-09-07 16:12:06 +01:00
Richard W.M. Jones
356c2c97bc python: Relicense setup.py to LGPLv2+ (originally GPLv2+)
Bug: https://bugzilla.redhat.com/show_bug.cgi?id=1951560#c3
(cherry picked from commit 2883fc2acc)
2021-09-07 16:12:06 +01:00
Richard W.M. Jones
a339b3c642 inspection: More reliable detection of Linux split /usr configurations
In RHEL 8+, /usr/etc no longer exists.  Since we were looking for this
directory in order to detect a separate /usr partition, those were no
longer detected, so the merging of /usr data into the root was not
being done.  The result was incomplete inspection data and failure of
virt-v2v.

All Linux systems since forever have had /usr/src but not /src, so
detect this instead.

Furthermore the merging code didn't work, because we expected that the
root filesystem had a distro assigned, but in this configuration we
may need to look for that information in /usr/lib/os-release (not on
the root filesystem).  This change makes the merging work even if we
have incomplete information about the root filesystem, so long as we
have an /etc/fstab entry pointing to the /usr mountpoint.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1949683
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1930133
Fixes: commit 394d11be49
(cherry picked from commit 26427b9ecc)
2021-09-07 16:12:06 +01:00
Richard W.M. Jones
0ce6203b5e Ignore return value from strerror_r.
It seems like newer glibc added warn_unused_result to this function.
Try harder to ignore the result.

(cherry picked from commit 7ed0da779f)
2021-09-07 16:12:06 +01:00
Richard W.M. Jones
f02fe52867 golang: Fix quoting in Makefile.
Fixes: commit c8cab6219f
Fixes: commit 95de3f6c50
(cherry picked from commit 2ebacabd68)
2021-09-07 16:12:06 +01:00
Richard W.M. Jones
c8ba668a49 golang: Fix build when libguestfs is not already installed.
See similar fix in libnbd:
031aaefaa8

Fixes: commit 95de3f6c50
(cherry picked from commit afe7e16c0f)
2021-09-07 16:12:06 +01:00
Richard W.M. Jones
38b7f43873 golang: Add go.mod to EXTRA_DIST.
Fixes: commit 95de3f6c50
(cherry picked from commit 4c6de453f1)
2021-09-07 16:12:06 +01:00
Richard W.M. Jones
78732ac9af golang: Try to deal with srcdir != builddir builds.
Updates: commit 95de3f6c50
Thanks: Gianfranco Costamagna
(cherry picked from commit c8cab6219f)
2021-09-07 16:12:06 +01:00
Richard W.M. Jones
9c8884fbbe golang: Partially fix the tests.
./guestfs.go:4945:16: conversion from _Ctype_char (int8) to string yields a string of one rune, not a string of digits (did you mean fmt.Sprint(x)?)
./guestfs.go:7320:16: conversion from _Ctype_char (int8) to string yields a string of one rune, not a string of digits (did you mean fmt.Sprint(x)?)
./guestfs.go:7335:16: conversion from _Ctype_char (int8) to string yields a string of one rune, not a string of digits (did you mean fmt.Sprint(x)?)

(cherry picked from commit 93c2d09136)
2021-09-07 16:12:06 +01:00
Richard W.M. Jones
e520e7a4cb golang: Fix bindings for golang 1.16.
See https://blog.golang.org/go116-module-changes

(cherry picked from commit 95de3f6c50)
2021-09-07 16:12:06 +01:00
Richard W.M. Jones
d407f120f6 Port libguestfs to use pcre2 instead of pcre.
https://bugzilla.redhat.com/show_bug.cgi?id=1938982
(cherry picked from commit 82493579f3)
2021-09-07 16:12:06 +01:00
Richard W.M. Jones
5826fd1f42 Version 1.44.1. v1.44.1 2021-04-03 12:10:32 +01:00
Richard W.M. Jones
d20b7d4e57 lib/appliance-kcmdline.c: Read UUID directly from appliance.
Instead of using the external file utility, read the UUID directly
from the extfs filesystem.  file 5.40 broke parsing of UUIDs
(https://bugs.astron.com/view.php?id=253).

Bug: https://bugzilla.redhat.com/show_bug.cgi?id=1945122
(cherry picked from commit 278d0d3226)
2021-04-03 11:25:20 +01:00
Richard W.M. Jones
832bfdafdb daemon/xfs.c: Fix error message.
Fixes: commit 87206e4e9e
(cherry picked from commit 49b8b69cb8)
2021-04-03 11:25:07 +01:00
Richard W.M. Jones
3d7e80e2e8 daemon: chroot: Fix long-standing possible deadlock.
The child (chrooted) process wrote its answer on the pipe and then
exited.  Meanwhile the parent waiting for the child to exit before
reading from the pipe.  Thus if the output was larger than a Linux
pipebuffer then the whole thing would deadlock.

(cherry picked from commit 94e64b28be)
2021-04-03 11:24:42 +01:00
Richard W.M. Jones
55341d5c52 tests: btrfs: Use a valid sector size in the test.
Latest btrfs seems to reject 512 byte sector size.  It may be because
of the specific hardware that I'm running the test on.  Anyway using a
4K sector size works.

libguestfs: error: mkfs_btrfs: /dev/sda1: ERROR: invalid sectorsize 512, expected range is [4K, 64K]
(cherry picked from commit 48a35c117e)
2021-04-03 11:24:38 +01:00
Richard W.M. Jones
9477818397 tests/mount-local/test-parallel-mount-local.c: Fix bogus -fanalyzer warning.
See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99716 for the reduced
test case.

(cherry picked from commit 9dddd8ec62)
2021-04-03 11:24:00 +01:00
Richard W.M. Jones
70a9861266 daemon: Don't return bogus failure from readdir.
This was returning "readdir: Invalid argument" which is actually
impossible (readdir(3) cannot fail with EINVAL).  It turns out that
the problem is just errno from some other place leaking out.

(cherry picked from commit e0a1106103)
2021-04-03 11:23:54 +01:00
Richard W.M. Jones
de9eb5edda tests/charsets/test-charset-fidelity.c: Print all errors.
Not just the first error.

(cherry picked from commit e282558581)
2021-04-03 11:23:47 +01:00