Closed GZTimeWalker closed 8 months ago
Some progress:
[#0] 0xffffff0000085a11 → x86_64::addr::VirtAddr::new(addr=<optimized out>, addr=<optimized out>)
[#1] 0xffffff0000085a11 → x86_64::addr::{impl#8}::add(rhs=<optimized out>, rhs=<optimized out>)
[#2] 0xffffff0000085a11 → x86_64::structures::paging::mapper::mapped_page_table::{impl#5}::clean_up_addr_range::clean_up<PhysOffset, ...>()
[#3] 0xffffff000006ee55 → x86_64::structures::paging::mapper::mapped_page_table::{impl#5}::clean_up_addr_range<PhysOffset, ..>(...)
Does this patch fix the issue?
diff --git a/src/structures/paging/mapper/mapped_page_table.rs b/src/structures/paging/mapper/mapped_page_table.rs
index 25e83e1..53fc869 100644
--- a/src/structures/paging/mapper/mapped_page_table.rs
+++ b/src/structures/paging/mapper/mapped_page_table.rs
@@ -646,7 +646,11 @@ impl<'a, P: PageTableFrameMapping> CleanUp for MappedPageTable<'a, P> {
.skip(usize::from(start))
{
if let Ok(page_table) = page_table_walker.next_table_mut(entry) {
- let start = table_addr + (offset_per_entry * (i as u64));
+ let start = VirtAddr::forward_checked_impl(
+ table_addr,
+ (offset_per_entry as usize) * i,
+ )
+ .unwrap();
let end = start + (offset_per_entry - 1);
let start = Page::<Size4KiB>::containing_address(start);
let start = start.max(range.start);
Does this patch fix the issue?
It will fix this issue in my case.
I'm migrating to v0.15.0, found that a
VirtualAddr
panic is triggered when the page table calledclean_up
.It caused by the
new
function introduced in https://github.com/rust-osdev/x86_64/pull/370.But since my kernel doesn't have backtrace, I am trying to find out why this is happening through step-by-step debugging.