Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1822889

Summary: hivexml fails to convert Windows 10 Registry
Product: Red Hat Enterprise Linux 7 Reporter: YongkuiGuo <yoguo>
Component: hivexAssignee: Richard W.M. Jones <rjones>
Status: CLOSED ERRATA QA Contact: YongkuiGuo <yoguo>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 7.9   
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: hivex-1.3.10-6.10.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-09-29 20:38:58 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
hivexml output
none
Registry file
none
hivexml debug output none

Description YongkuiGuo 2020-04-10 10:17:50 UTC
Created attachment 1677769 [details]
hivexml output

Description of problem:
The hivexml command fails to convert Windows 10 Registry


Version-Release number of selected component (if applicable):
libguestfs-1.40.2-9.el7.x86_64
hivex-1.3.10-6.9.el7.x86_64


How reproducible:
100%


Steps:

1. Prepare a Windows 10 guest image on rhel7.9 host

# guestfish -a Win10-64-hvm.raw
><fs> set-program virt-trickery
><fs> run
><fs> mount /dev/sda2 /
><fs> download /Windows/System32/config/SOFTWARE /tmp/autotest-libguestfs/hivex/Win10-64-hvm.software
><fs> quit

2.
# hivexml /tmp/autotest-libguestfs/hivex/Win10-64-hvm.software
...
hivex_visit: /tmp/autotest-libguestfs/hivex/Win10-64-hvm.software: Numerical result out of range



Actual results:
The hivexml command can be able to convert Windows 10 Registry successfully.

Expected results:
No error output.


Additional info:
The same error on Windows Server 2016

Comment 2 YongkuiGuo 2020-04-10 10:19:32 UTC
Created attachment 1677770 [details]
Registry file

Comment 3 YongkuiGuo 2020-04-10 10:29:59 UTC
Created attachment 1677771 [details]
hivexml debug output

Comment 4 YongkuiGuo 2020-04-10 11:31:50 UTC
Fails to run the following command, maybe the same error.

#virt-win-reg images/Win10-64-hvm.raw 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\SideBySide\Winners' --debug
...
hivex: hivex_open: successfully read Windows Registry hive file:
  pages:          15901 [sml: 4096, lge: 16384]
  blocks:         1196270 [sml: 8, avg: 55, lge: 16352]
  blocks used:    1195740
  bytes used:     66568120
exporting \Microsoft\Windows\CurrentVersion\SideBySide\Winners from software with prefix HKEY_LOCAL_MACHINE\SOFTWARE ... at /usr/bin/virt-win-reg line 361.
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\SideBySide\Winners]
hivex: _hivex_get_values: nr_values = 0

hivex: _hivex_get_children: returning ERANGE because: nr_subkeys_in_nk > HIVEX_MAX_SUBKEYS (17009 > 15000)
node_children: Numerical result out of range at /usr/lib64/perl5/vendor_perl/Win/Hivex/Regedit.pm line 621.
hivex: hivex_close: hivex_close

Comment 5 YongkuiGuo 2020-05-18 14:03:39 UTC
rjones, could you take a look at this issue if you are available?

Comment 6 Richard W.M. Jones 2020-05-18 20:06:47 UTC
Sorry for missing this.  The pertinent point is indeed this one:

hivex: _hivex_get_children: returning ERANGE because: nr_subkeys_in_nk > HIVEX_MAX_SUBKEYS (17009 > 15000)

This limit was lifted twice since RHEL 7 was released, in:

https://github.com/libguestfs/hivex/commit/bec3f0bb632c4b84a1dfb73eb6333c2ba9834ffb#diff-1ca1183b8a0f460c0afef5b4322d82b4
https://github.com/libguestfs/hivex/commit/4b024fa031251fbeacb6ecf2821d8d027d59de0d#diff-1ca1183b8a0f460c0afef5b4322d82b4

We could easily backport one of both of these patches to RHEL 7.x if
there is time.  I will devel ack this bug, although as it is not a
customer bug maybe we will not actually do this at such a late stage
in the RHEL 7 cycle.

Comment 9 YongkuiGuo 2020-05-19 10:00:19 UTC
Verified with package:
hivex-1.3.10-6.10.el7.x86_64

Steps:

1. On rhel7.9 host

# guestfish -a Win10-64-hvm.raw
><fs> set-program virt-trickery
><fs> run
><fs> mount /dev/sda2 /
><fs> download /Windows/System32/config/SOFTWARE /tmp/Win10-64-hvm.software
><fs> quit

2.
# hivexml /tmp/Win10-64-hvm.software

It works well. No error output.

Comment 11 errata-xmlrpc 2020-09-29 20:38:58 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (hivex bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:4022