Unsafety in `Madt::entries`
Closed this issue · 1 comments
pyelias commented
If you copy a Madt out of its PhysicalMapping, entries will take entries from the memory after the copy, not from the PhysicalMapping's memory.
let madt: Madt = *acpi_tables.find_table::<Madt>().unwrap();
for entry in madt.entries() {
// entry will have bad data
}
This could be fixed by forcing entries to take a PhysicalMapping<_, Madt> and verify its size.
IsaacWoods commented
Apologies for the delay in getting back to you, and thank you for taking the time to report this! This is indeed unsound unfortunately.
We couldn't do a straight swap to taking a PhysicalMapping on entries I don't think without making it a free function. I wonder if we can instead use Pin to stop tables that are larger than our representations of them being moved - I'll have a play around and see what I can do.