Closed RevolutionXenon closed 2 years ago
Good catch we should definitely not panic in that situation. We could change Cr2::read
to return Result<VirtAddr, VirtAddrNotValid>
and add a new method Cr2::read_raw
that returns u64
.
Changing Cr2::read
would be a breaking change, but adding Cr2::read_raw
could be done right now.
Should this stay open to track the (breaking) change to Cr2::read
?
Whoops I just saw #335 I guess that PR (when merged) should close this issue.
I think this issue can be closed.
https://docs.rs/x86_64/latest/src/x86_64/registers/control.rs.html#267
When CR2 contains a malformed address, this panic occurs: "panicked at 'address passed to VirtAddr::new must not contain any data in bits 48 to 64"
CR2 can obviously contain a non-canonical address after a page fault. This panic should not occur. I'm not sure what the best fix would be, but I ran into this because I tried to print CR2 in my panic handler and it just starts looping when you do that.