crosvm/base
Daniel Verkamp 4b6c33d346 base: windows: error if CPU >= 64 in set_cpu_affinity
The loop that generates the CPU affinity mask uses a shift by the CPU
index to generate a u64, so if the shift count is 64 or greater, it will
shift past the end of the u64 and panic when overflow checks are enabled
(which we enable by default in release builds in Cargo.toml).

Add a bounds check so set_cpu_affinity() will return an error rather
than causing a panic in this case.

BUG=None
TEST=run tests via wine on 72 logical core machine

Change-Id: I2ac4a0602b2c014aeca4939ec2882926cdfe2c29
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3935523
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2022-10-14 20:04:46 +00:00
..
base_event_token_derive Update all copyright headers to match new style 2022-09-13 18:41:29 +00:00
src base: windows: error if CPU >= 64 in set_cpu_affinity 2022-10-14 20:04:46 +00:00
.build_test_serial Refactoring: Move common/base into base 2022-03-17 00:01:27 +00:00
Cargo.toml crosvm: fold windows-only proto-tube-hack into kiwi 2022-09-08 19:04:26 +00:00