Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates to Portable SR Functionality (1.249-lcm) #5841

Merged
merged 2 commits into from
Jul 17, 2024

Conversation

alexbrett
Copy link
Contributor

XSA-459 (https://xenbits.xen.org/xsa/advisory-459.html) covers a security issue with the Portable SR (also known as VM Metadata Backup/Restore) functionality.

Now the embargo has lifted, this PR includes the content of the XSA patch, and another bugfix to the vbd cleanup identified whilst working on the security issue (the bugfix was not published previously to avoid drawing interest in the functionality during the embargo period).

Add a new option `-o` to xe-restore-metadata, which is used to distinguish
whether to allow use of legacy backup VDIs, or enforce only use of the new
format VDIs with known UUIDs.

Also modify xe-restore-metadata such that it no longer stops searching the
candidate list if only one VDI is found, but instead identifies all possible
backup VDIs. If more than one is found, and you are doing anything other than
listing the VDIs, the script will abort. This is to cover the case where a
malicious legacy format VDI is present - we will detect it and the expected
'real' backup VDI.

Modify xe-backup-metadata to always expect to use the deterministic UUID to
identify the VDI to add backups to, do not rely on the
`other-config:ctxs-pool-backup` property for identification in any way.

This is XSA-459 / CVE-2024-31144

Also fix the following issues introduced with changes in v1.249.37:
- Incorrect path to `xe` when calling vm-import
- Issues using 'dry run' functionality due to shell quoting changes

Signed-off-by: Alex Brett <[email protected]>
The xe-[backup,restore]-metadata scripts have cleanup logic designed to ensure
we do not leave any vbd objects etc behind.

This logic calls `vbd-unplug` with a 20s timeout, and then (regardless of the
result) allows up to 10s for any device specified in the VBD to disappear - if
it does not, it does not trigger a `vbd-destroy`.

This logic fails in the case where a VDI is attached to a VM running on the same
host, as the `device` field in the new VBD will be populated with the backend
device for the running VM. In this case, the `vbd-unplug` fails immediately (as
the vbd is not plugged because the original `vbd-plug` attempt fails as the VDI
is in use), but then we sit waiting for 10s for the device to disappear (which
is obviously does not), and then fail to trigger a `vbd-destroy`, leaving the
VBD behind.

Fix this by simply removing the wait for the device to disappear and always
attempting a `vbd-destroy`, as I am not aware of any situation where this
additional 10s wait will give any benefit given current behaviours.

Signed-off-by: Alex Brett <[email protected]>
@alexbrett
Copy link
Contributor Author

Associated xsconsole PR xapi-project/xsconsole#46

@robhoes robhoes mentioned this pull request Jul 16, 2024
@lindig lindig merged commit bb29f94 into xapi-project:1.249-lcm Jul 17, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants