Check wstatus in check_raw_capability.

The winfo field is only populated with capability bits if wstatus is
nonzero.  If wstatus is zero, those bits are re-used and indicate why
HAXM is not usable.

Bug: 357064526
Test: tested locally
Change-Id: I9cb0c82267095e4f89c879d48d8a3b7c00dfe36c
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5792562
Commit-Queue: Idan Raiter <idanr@google.com>
Commit-Queue: Judson Powers <judsonp@google.com>
Auto-Submit: Judson Powers <judsonp@google.com>
Reviewed-by: Idan Raiter <idanr@google.com>
This commit is contained in:
Judson Powers 2024-08-16 17:29:05 +00:00 committed by crosvm LUCI
parent 31eda0ce99
commit b75642742d

View file

@ -122,6 +122,13 @@ impl HaxmVm {
return false;
}
// If wstatus is zero, HAXM is not usable.
// In this case, the winfo bits indicate why, rather than communicating capability
// information.
if capability_info.wstatus == 0 {
return false;
}
(cap & capability_info.winfo as u32) != 0
}