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

WinHvPlatform.dll crashes Obliteration when pressing Start on any game. #914

Open
VocalFan opened this issue Jul 31, 2024 · 25 comments
Open
Labels
P-windows Platform: Windows T-bug Type: Bug

Comments

@VocalFan
Copy link
Member

Faulting application name: Obliteration.exe, version: 0.0.1.0, time stamp: 0x66aa766c
Faulting module name: WinHvPlatform.dll, version: 10.0.22621.3672, time stamp: 0xb628bb33
Exception code: 0xc0000005
Fault offset: 0x00000000000076d7
Faulting application path: C:\Users\ghost\Downloads\obliteration-win-x64\Obliteration.exe
Faulting module path: C:\WINDOWS\SYSTEM32\WinHvPlatform.dll

@SuchAFuriousDeath
Copy link
Contributor

This will be a joy to debug 💀

@VocalFan
Copy link
Member Author

And I can't help but feel like Ultima removed the log file being in appdata...

@VocalFan
Copy link
Member Author

This will be a joy to debug 💀

(bac.3048): Access violation - code c0000005 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
WinHvPlatform!WHvApi::Hypercall::SetVpRegisters+0x1df:
00007ffc`12d976d7 410f280402      movaps  xmm0,xmmword ptr [r10+rax] ds:0000007d`18affb38=0000000000000000ffffffff8240c000

@ultimaweapon
Copy link
Member

Can you identify which line that cause this error?

@VocalFan
Copy link
Member Author

VocalFan commented Aug 1, 2024

@ultimaweapon GOTCHA

    fn states(&mut self) -> Result<Self::States<'_>, Self::GetStatesErr> {
        let mut values: [WHV_REGISTER_VALUE; REGISTERS] = unsafe { zeroed() };
        let status = unsafe {
            WHvGetVirtualProcessorRegisters(
                self.part,
                self.index,
                WhpStates::NAMES.as_ptr(),
                REGISTERS as _,
                values.as_mut_ptr(),
            )
        };

Here;
WHvGetVirtualProcessorRegisters(

@ultimaweapon ultimaweapon added T-bug Type: Bug P-windows Platform: Windows labels Aug 1, 2024
@ultimaweapon
Copy link
Member

I have no idea what causing segmentation fault here. We probably need someone with Windows to fix this.

@VocalFan
Copy link
Member Author

VocalFan commented Aug 2, 2024

Deduction here:

self.part, unless cloned, println!'d, or otherwise affected before being used by WHvGetVirtualProcessorRegisters... Will be free'd before WHvGetVirtualProcessorRegisters can use it, causing a Memory Access Violation.

@SuchAFuriousDeath
Copy link
Contributor

That makes no sense I think

@VocalFan
Copy link
Member Author

VocalFan commented Aug 2, 2024

That makes no sense I think

It's what happens, however... The value is getting dropped for SOME reason unless I use something to make it active in the function before WHvGetVirtualProcessorRegisters uses it...

@SuchAFuriousDeath
Copy link
Contributor

But that doesn't make sense. You can't 'drop' an int.

@VocalFan
Copy link
Member Author

VocalFan commented Aug 2, 2024

But that doesn't make sense. You can't 'drop' an int.

And I find it weird that if I do self.part = self.part.clone(), it works.

@ultimaweapon
Copy link
Member

That why we need to figure out why it is crashing because your fix does not make sense.

@VocalFan
Copy link
Member Author

VocalFan commented Aug 2, 2024

That why we need to figure out why it is crashing because your fix does not make sense.

Welllll, have fun with Miri https://github.com/rust-lang/miri

@ultimaweapon
Copy link
Member

@VocalFan you can set a breakpoint on that line and view its assembly once the breakpoint are hit to see how it calls the function?

@VocalFan
Copy link
Member Author

VocalFan commented Aug 4, 2024

@VocalFan you can set a breakpoint on that line and view its assembly once the breakpoint are hit to see how it calls the function?

{part:2517404947584, index:0}

This is for self.part and self.index

@VocalFan
Copy link
Member Author

VocalFan commented Aug 4, 2024

image

@VocalFan
Copy link
Member Author

VocalFan commented Aug 4, 2024

image
Error point.

@VocalFan
Copy link
Member Author

VocalFan commented Aug 4, 2024

rip: 0x00007FF76F742C27
rsp: 0x000000FED0DFD690
eax: 0xD0DFD470

@ultimaweapon
Copy link
Member

No idea what wrong here since everything looks okay.

@VocalFan
Copy link
Member Author

VocalFan commented Aug 4, 2024

No idea what wrong here since everything looks okay.

Maybe a bug with windows-sys?

@ultimaweapon
Copy link
Member

Everything here looks correctly so no. Seems like I need to set up a Windows machine to figure out.

@VocalFan
Copy link
Member Author

Gonna see if this magically got fixed

@VocalFan
Copy link
Member Author

image
I mean, it's new.

@VocalFan
Copy link
Member Author

.next_multiple_of(Ram::VM_PAGE_SIZE) a very temporary thing of this on p_vaddr, and guess what came back?

Stop reason: Exception 0xc0000005 encountered at address 0x7ffc2bef39c6: Access violation reading location 0xffffffffffffffff
image

@VocalFan
Copy link
Member Author

But I think that might be a hint, the unaligned address.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P-windows Platform: Windows T-bug Type: Bug
Development

No branches or pull requests

3 participants