4d61726b / VirtualKD-Redux

VirtualKD-Redux - A revival and modernization of VirtualKD
GNU Lesser General Public License v2.1
777 stars 136 forks source link

kdbazis.dll backwards compatibility between releases #25

Closed misterzed88 closed 3 years ago

misterzed88 commented 3 years ago

When using VirtualKD-Redux with existing VMs, where kdbazis.dll was installed from the original VirtualKD fork, vmmon complains about version incompatibilities: "Warning: kdbazis.dll version x.xx was loaded ... while version 2020.5 was expected ... please upgrade"

Is the kdbazis.dll version check also so strict that it kicks in on every VirtualKD-Redux update?

Would it be possible to relax this version check, assuming that there is a way to be backwards compatible with kdbazis.dlls present in older VirtualKD/VirtualKD-Redux releases?

The version check is fine when installing new VMs but forces the user to upgrade all existing guest VMs on a VirtualKD update on the host. It would be really nice if this could be avoided, unless absolutely necessary.

4d61726b commented 3 years ago

I can understand the frustration of having to run vminstall again on a VM, especially when you have a ton of VMs you now have to upgrade.

The kdbazis component does not change that often. Its original design was to only need to be upgraded if the protocol was changed. My original intent was to force an upgrade if a bug was fixed in kdbazis. The basis for this was to help prevent people from filing new issues in github for a bug that was already fixed in a newer release. I would guess that most people never upgrade kdbazis in their VMs (simply out of forgetfulness) and just use the new vmmon on their host when a new release comes out.

That being said, I can make some modifications to only force an upgrade of kdbazis if:

  1. The protocol was changed or
  2. A bugfix was made to the kdbazis component

I will do that for the next release. Depending on how it gets implemented, you may have to do one more upgrade of kdbazis to get it in version state parity with newer versions of kdclient/vmmon.

misterzed88 commented 3 years ago

I see, thanks for clarifying the motives for the version check feature. The proposed fix would certainly improve things in the future.

As a further improvement, I would still suggest that you consider if Redux can not be made seamlessly backwards compatible with Virtual KD. I would think that an important use case is when someone upgrades from VirtualKD to Virtual KD redux. That user may have tons of existing VMs, with even more snapshots. Forcing the user to update kdbazis in all of them may be a too inconvenient to actually do the switch.

The original VirtualKD branch kept the protocol, and the KDRPC_PROTOCOL_VERSION, stable between releases, for this reason. Unless you have made breaking changes to the protocol, I would like to suggest that you consider reverting back to the original version (0x0101) and thereby keep backwards compatibility. Or, at least, consider adding an option (registry or command line) where people can force the use of the old version.

In my specific case this is not an issue (since I am happily running a custom build with KDRPC_PROTOCOL_VERSION being reverted to 0x0101). But other users may run into the same issue and would benefit from improved backwards compatibility.

4d61726b commented 3 years ago

Okay, I see this issue being solved with two changes:

  1. We have a minimum version number which only changes when there is a bugfix to kdbazis OR a modification to the kdrpc protocol. This would force users to rerun vminstall and upgrade kdbazis in the guest in either of those cases.
  2. For power users, we also have an undocumented "version override" registry value on the host that can be written to. If set, the value will be used by kdclient to report to kdbazis which will detect a version match/mismatch.

Does that sound good to you?

misterzed88 commented 3 years ago

The proposed solution sounds good, thanks!

And I assume that the "version override" would be used in all places where KDRPC_PROTOCOL_VERSION is currently used, including when kdclient checks the version reported from kdbazis on the guest.

4d61726b commented 3 years ago

That's correct. This will be addressed in the next release which should go out this weekend.

4d61726b commented 3 years ago

This issue should be addressed in 2021.0. There were quite a lot of changes to make this happen, so I am a bit worried that a new bug was introduced. If you notice anything not working correctly let me know. The value to modify:

HKEY_CURRENT_USER\SOFTWARE\VirtualKD-Redux\VersionOverride

misterzed88 commented 3 years ago

I tested the fix and it works just as expected. Thanks!