diff --git a/0014-daemon-inspect_fs_windows.ml-Add-debugging-for-MBR-d.patch b/0014-daemon-inspect_fs_windows.ml-Add-debugging-for-MBR-d.patch new file mode 100644 index 0000000..47c4868 --- /dev/null +++ b/0014-daemon-inspect_fs_windows.ml-Add-debugging-for-MBR-d.patch @@ -0,0 +1,75 @@ +From b43ca06ea69cebbdd774ed03bc0da63eb3955d66 Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Thu, 14 Aug 2025 14:56:47 +0100 +Subject: [PATCH] daemon/inspect_fs_windows.ml: Add debugging for MBR drive + mappings + +The function 'map_registry_disk_blob_gpt' immediately below this one +has a debugging statement. Add the equivalent to the function +'map_registry_disk_blob_mbr'. + +The output looks like: + + map_registry_disk_blob_mbr: searching for MBR disk ID 31 32 33 34 + map_registry_disk_blob_mbr: searching for MBR partition offset 00 00 00 10 00 00 00 00 +--- + daemon/inspect_fs_windows.ml | 8 ++++++++ + daemon/utils.ml | 4 ++++ + daemon/utils.mli | 4 ++++ + 3 files changed, 16 insertions(+) + +diff --git a/daemon/inspect_fs_windows.ml b/daemon/inspect_fs_windows.ml +index dbaf4c362..5991cdba3 100644 +--- a/daemon/inspect_fs_windows.ml ++++ b/daemon/inspect_fs_windows.ml +@@ -376,6 +376,10 @@ and map_registry_disk_blob_mbr devices blob = + * disk with this disk ID. + *) + let diskid = String.sub blob 0 4 in ++ if verbose () then ++ eprintf "map_registry_disk_blob_mbr: searching for MBR disk ID %s\n%!" ++ (hex_of_string diskid); ++ + let device = + List.find ( + fun dev -> +@@ -388,6 +392,10 @@ and map_registry_disk_blob_mbr devices blob = + * partition byte offset from Parted.part_list. + *) + let offset = String.sub blob 4 8 in ++ if verbose () then ++ eprintf "map_registry_disk_blob_mbr: searching for MBR partition offset \ ++ %s\n%!" ++ (hex_of_string offset); + let offset = int_of_le64 offset in + let partitions = Parted.part_list device in + let partition = +diff --git a/daemon/utils.ml b/daemon/utils.ml +index 40584c9f1..3aa1d7ed2 100644 +--- a/daemon/utils.ml ++++ b/daemon/utils.ml +@@ -291,3 +291,7 @@ let parse_key_value_strings ?unquote lines = + match unquote with + | None -> lines + | Some f -> List.map (fun (k, v) -> (k, f v)) lines ++ ++let hex_of_string s = ++ let bytes = String.map_chars (fun c -> sprintf "%02x" (Char.code c)) s in ++ String.concat " " bytes +diff --git a/daemon/utils.mli b/daemon/utils.mli +index 0f2ae471f..e14735038 100644 +--- a/daemon/utils.mli ++++ b/daemon/utils.mli +@@ -121,5 +121,9 @@ val parse_key_value_strings : ?unquote:(string -> string) -> string list -> (str + it is applied on the values as unquote function. Empty lines, + or that start with a comment character [#], are ignored. *) + ++val hex_of_string : string -> string ++(** Return a string as a list of hex bytes. ++ Use this for debugging msgs only. *) ++ + (**/**) + val get_verbose_flag : unit -> bool +-- +2.47.1 + diff --git a/0015-daemon-inspect_fs_windows.ml-Add-debugging-when-we-s.patch b/0015-daemon-inspect_fs_windows.ml-Add-debugging-when-we-s.patch new file mode 100644 index 0000000..8a492e3 --- /dev/null +++ b/0015-daemon-inspect_fs_windows.ml-Add-debugging-when-we-s.patch @@ -0,0 +1,32 @@ +From 7bbadaec5ab9c60bd5ad8e1feee39af9f170b552 Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Thu, 14 Aug 2025 14:57:45 +0100 +Subject: [PATCH] daemon/inspect_fs_windows.ml: Add debugging when we start + registry analysis + +Add some debugging when we begin the process of analyzing the Windows +registry of a guest. +--- + daemon/inspect_fs_windows.ml | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/daemon/inspect_fs_windows.ml b/daemon/inspect_fs_windows.ml +index 5991cdba3..00acf5196 100644 +--- a/daemon/inspect_fs_windows.ml ++++ b/daemon/inspect_fs_windows.ml +@@ -207,6 +207,12 @@ and check_windows_registry systemroot data = + if Is.is_file system_hive then Some system_hive else None in + data.windows_system_hive <- system_hive; + ++ if verbose () then ++ eprintf "check_windows_registry: software hive: %s\n\ ++ check_windows_registry: system hive: %s\n%!" ++ (Option.value ~default:"None" software_hive) ++ (Option.value ~default:"None" system_hive); ++ + match software_hive, system_hive with + | None, _ | Some _, None -> () + | Some software_hive, Some system_hive -> +-- +2.47.1 + diff --git a/0016-daemon-inspect_fs_windows.ml-Ignore-blank-disks-in-d.patch b/0016-daemon-inspect_fs_windows.ml-Ignore-blank-disks-in-d.patch new file mode 100644 index 0000000..1da6415 --- /dev/null +++ b/0016-daemon-inspect_fs_windows.ml-Ignore-blank-disks-in-d.patch @@ -0,0 +1,78 @@ +From 42afed95dc6611dc9585ab23134bdcc39a5b75ec Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Thu, 14 Aug 2025 15:17:59 +0100 +Subject: [PATCH] daemon/inspect_fs_windows.ml: Ignore blank disks in drive + mapping + +If HKLM\System\MountedDevices references a blank disk, then when we +try to search for the actual backing device we will get an error from +parted: + + parted: /dev/sdb: parted exited with status 1: Error: /dev/sdb: unrecognised disk label: Invalid argument + +Just ignore these errors instead of failing inspection. + +Fixes: https://issues.redhat.com/browse/RHEL-108803 +Reported-by: Ameen Barakat +Thanks: Ming Xie +--- + daemon/inspect_fs_windows.ml | 35 ++++++++++++++++++++++++++--------- + 1 file changed, 26 insertions(+), 9 deletions(-) + +diff --git a/daemon/inspect_fs_windows.ml b/daemon/inspect_fs_windows.ml +index 00acf5196..ba8ef4ee3 100644 +--- a/daemon/inspect_fs_windows.ml ++++ b/daemon/inspect_fs_windows.ml +@@ -389,8 +389,18 @@ and map_registry_disk_blob_mbr devices blob = + let device = + List.find ( + fun dev -> +- Parted.part_get_parttype dev = "msdos" && ++ try ++ Parted.part_get_parttype dev = "msdos" && + pread dev 4 0x01b8 = diskid ++ with Unix.Unix_error (EINVAL, "parted", msg) -> ++ (* Errors can happen here if the disk is empty. Just ignore ++ * them. It means the drive mapping might have missing ++ * entries but that's not important. (RHEL-108803) ++ *) ++ if verbose () then ++ eprintf "map_registry_disk_blob_mbr: parted returned: \ ++ %s (ignored)\n" msg; ++ false + ) devices in + + (* Next 8 bytes are the offset of the partition in bytes(!) given as +@@ -428,14 +438,21 @@ and map_registry_disk_blob_gpt partitions blob = + let partition = + List.find ( + fun part -> +- let partnum = Devsparts.part_to_partnum part in +- let device = Devsparts.part_to_dev part in +- let typ = Parted.part_get_parttype device in +- if typ <> "gpt" then false +- else ( +- let guid = Sfdisk.part_get_gpt_guid device partnum in +- String.lowercase_ascii guid = blob_guid +- ) ++ try ++ let partnum = Devsparts.part_to_partnum part in ++ let device = Devsparts.part_to_dev part in ++ let typ = Parted.part_get_parttype device in ++ if typ <> "gpt" then false ++ else ( ++ let guid = Sfdisk.part_get_gpt_guid device partnum in ++ String.lowercase_ascii guid = blob_guid ++ ) ++ with Unix.Unix_error (EINVAL, "parted", msg) -> ++ (* See comment in MBR code above (RHEL-108803) *) ++ if verbose () then ++ eprintf "map_registry_disk_blob_gpt: parted returned: \ ++ %s (ignored)\n" msg; ++ false + ) partitions in + Some partition + with +-- +2.47.1 + diff --git a/0014-RHEL-Disable-unsupported-remote-drive-protocols-RHBZ.patch b/0017-RHEL-Disable-unsupported-remote-drive-protocols-RHBZ.patch similarity index 99% rename from 0014-RHEL-Disable-unsupported-remote-drive-protocols-RHBZ.patch rename to 0017-RHEL-Disable-unsupported-remote-drive-protocols-RHBZ.patch index 00bf729..a141253 100644 --- a/0014-RHEL-Disable-unsupported-remote-drive-protocols-RHBZ.patch +++ b/0017-RHEL-Disable-unsupported-remote-drive-protocols-RHBZ.patch @@ -1,4 +1,4 @@ -From ad17d4a59c67c43170f8b364981ee34e14e4e268 Mon Sep 17 00:00:00 2001 +From d1808ea5eb7ad9c38f5f8c5e90d086886300acd8 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Mon, 29 Jul 2013 14:47:56 +0100 Subject: [PATCH] RHEL: Disable unsupported remote drive protocols diff --git a/0015-RHEL-Reject-use-of-libguestfs-winsupport-features-ex.patch b/0018-RHEL-Reject-use-of-libguestfs-winsupport-features-ex.patch similarity index 97% rename from 0015-RHEL-Reject-use-of-libguestfs-winsupport-features-ex.patch rename to 0018-RHEL-Reject-use-of-libguestfs-winsupport-features-ex.patch index 24124c7..29637d7 100644 --- a/0015-RHEL-Reject-use-of-libguestfs-winsupport-features-ex.patch +++ b/0018-RHEL-Reject-use-of-libguestfs-winsupport-features-ex.patch @@ -1,4 +1,4 @@ -From 3a905a409f19496664ba0ca82d7ed4950fd0d07b Mon Sep 17 00:00:00 2001 +From f8e4c310bb580e576d4962c395a99278e039fdf4 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 7 Jul 2015 09:28:03 -0400 Subject: [PATCH] RHEL: Reject use of libguestfs-winsupport features except for diff --git a/0016-RHEL-appliance-init-Run-depmod-a-to-rebuild-kernel-m.patch b/0019-RHEL-appliance-init-Run-depmod-a-to-rebuild-kernel-m.patch similarity index 90% rename from 0016-RHEL-appliance-init-Run-depmod-a-to-rebuild-kernel-m.patch rename to 0019-RHEL-appliance-init-Run-depmod-a-to-rebuild-kernel-m.patch index d41c4da..cb12a60 100644 --- a/0016-RHEL-appliance-init-Run-depmod-a-to-rebuild-kernel-m.patch +++ b/0019-RHEL-appliance-init-Run-depmod-a-to-rebuild-kernel-m.patch @@ -1,4 +1,4 @@ -From 13ca6121971b8fdca211ee5b0acef30bde2248ff Mon Sep 17 00:00:00 2001 +From 7a16a0b3580b081abc4880644ed0e34b30670cae Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 13 May 2025 17:28:25 +0100 Subject: [PATCH] RHEL: appliance/init: Run depmod -a to rebuild kernel module diff --git a/libguestfs.spec b/libguestfs.spec index 17cf184..d689cdd 100644 --- a/libguestfs.spec +++ b/libguestfs.spec @@ -42,7 +42,7 @@ Summary: Access and modify virtual machine disk images Name: libguestfs Epoch: 1 Version: 1.56.1 -Release: 2%{?dist}.alma.1 +Release: 3%{?dist}.alma.1 License: LGPL-2.1-or-later # Build only for architectures that have a kernel @@ -95,9 +95,12 @@ Patch0010: 0010-daemon-Reimplement-guestfs_selinux_relabel-in-OCaml.patch Patch0011: 0011-generator-Implement-StringList-for-OCaml-functions.patch Patch0012: 0012-generator-Allow-StringList-Pathname-parameters.patch Patch0013: 0013-daemon-Deprecate-guestfs_selinux_relabel-replace-wit.patch -Patch0014: 0014-RHEL-Disable-unsupported-remote-drive-protocols-RHBZ.patch -Patch0015: 0015-RHEL-Reject-use-of-libguestfs-winsupport-features-ex.patch -Patch0016: 0016-RHEL-appliance-init-Run-depmod-a-to-rebuild-kernel-m.patch +Patch0014: 0014-daemon-inspect_fs_windows.ml-Add-debugging-for-MBR-d.patch +Patch0015: 0015-daemon-inspect_fs_windows.ml-Add-debugging-when-we-s.patch +Patch0016: 0016-daemon-inspect_fs_windows.ml-Ignore-blank-disks-in-d.patch +Patch0017: 0017-RHEL-Disable-unsupported-remote-drive-protocols-RHBZ.patch +Patch0018: 0018-RHEL-Reject-use-of-libguestfs-winsupport-features-ex.patch +Patch0019: 0019-RHEL-appliance-init-Run-depmod-a-to-rebuild-kernel-m.patch BuildRequires: autoconf, automake, libtool, gettext-devel @@ -1084,10 +1087,10 @@ rm ocaml/html/.gitignore %changelog -* Thu Aug 14 2025 Eduard Abdullin - 1:1.56.1-2.alma.1 +* Fri Aug 15 2025 Eduard Abdullin - 1:1.56.1-3.alma.1 - Enable building for ppc64le -* Wed Aug 13 2025 Richard W.M. Jones - 1:1.56.1-2 +* Thu Aug 14 2025 Richard W.M. Jones - 1:1.56.1-3 - Rebase to libguestfs 1.56.1 resolves: RHEL-81733 - Include host kernel information in libguestfs debugging output @@ -1113,6 +1116,8 @@ rm ocaml/html/.gitignore resolves: RHEL-93584 - Add guestfs_setfiles API resolves: RHEL-108832 +- Ignore blank disks in Windows drive mapping + resolves: RHEL-109258 * Tue Nov 26 2024 Richard W.M. Jones - 1:1.54.0-5 - Rebase to libguestfs 1.54.0