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

Unsafety in Madt::entries #218

Open
pyelias opened this issue Aug 17, 2024 · 1 comment
Open

Unsafety in Madt::entries #218

pyelias opened this issue Aug 17, 2024 · 1 comment

Comments

@pyelias
Copy link

pyelias commented Aug 17, 2024

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
Copy link
Member

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.

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

No branches or pull requests

2 participants