Skip to content

Commit 56b1533

Browse files
authored
Merge pull request #74 from matthewfahrenkrug/check-rsdp-sum
multiboot: Check RSDP checksum
2 parents a1c9bd6 + 2f55a27 commit 56b1533

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

Cargo.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mythril_multiboot2/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ license-file = "LICENSE"
88
description = "A intel-focused hypervisor using VT-x/EPT"
99

1010
[dependencies]
11-
multiboot2 = "0.8.1"
11+
multiboot2 = "0.9.0"
1212
mythril_core = { version = "*", path = "../mythril_core" }
1313
log = { version = "0.4.8", default-features = false }
1414
linked_list_allocator = "0.8.1"

mythril_multiboot2/src/services.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use alloc::string::ToString;
12
use multiboot2::BootInformation;
23
use mythril_core::acpi;
34
use mythril_core::error::{Error, Result};
@@ -41,6 +42,11 @@ impl VmServices for Multiboot2Services {
4142
self.info.rsdp_v1_tag().map_or_else(
4243
|| Err(Error::NotFound),
4344
move |tag_v1| {
45+
if !tag_v1.checksum_is_valid() {
46+
return Err(Error::InvalidValue(
47+
"Invalid RSDP V1 checksum".to_string(),
48+
));
49+
}
4450
let id = tag_v1.oem_id().unwrap_or(" ").as_bytes();
4551
arr.copy_from_slice(&id[0..6]);
4652
Ok(acpi::rsdp::RSDP::V1 {
@@ -51,6 +57,11 @@ impl VmServices for Multiboot2Services {
5157
)
5258
},
5359
move |tag_v2| {
60+
if !tag_v2.checksum_is_valid() {
61+
return Err(Error::InvalidValue(
62+
"Invalid RSDP V2 checksum".to_string(),
63+
));
64+
}
5465
let id = tag_v2.oem_id().unwrap_or(" ").as_bytes();
5566
let mut arr: [u8; 6] = [0; 6];
5667
arr.copy_from_slice(&id[0..6]);

0 commit comments

Comments
 (0)