obliteration icon indicating copy to clipboard operation
obliteration copied to clipboard

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

Open SoffiMeower opened this issue 1 year ago • 25 comments

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

SoffiMeower avatar Jul 31 '24 17:07 SoffiMeower

This will be a joy to debug :skull:

SuchAFuriousDeath avatar Jul 31 '24 18:07 SuchAFuriousDeath

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

SoffiMeower avatar Jul 31 '24 18:07 SoffiMeower

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

SoffiMeower avatar Jul 31 '24 18:07 SoffiMeower

Can you identify which line that cause this error?

ultimaweapon avatar Aug 01 '24 03:08 ultimaweapon

@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(

SoffiMeower avatar Aug 01 '24 07:08 SoffiMeower

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

ultimaweapon avatar Aug 01 '24 14:08 ultimaweapon

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.

SoffiMeower avatar Aug 02 '24 04:08 SoffiMeower

That makes no sense I think

SuchAFuriousDeath avatar Aug 02 '24 06:08 SuchAFuriousDeath

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...

SoffiMeower avatar Aug 02 '24 07:08 SoffiMeower

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

SuchAFuriousDeath avatar Aug 02 '24 07:08 SuchAFuriousDeath

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.

SoffiMeower avatar Aug 02 '24 07:08 SoffiMeower

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

ultimaweapon avatar Aug 02 '24 07:08 ultimaweapon

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

SoffiMeower avatar Aug 02 '24 08:08 SoffiMeower

@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?

ultimaweapon avatar Aug 04 '24 04:08 ultimaweapon

@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

SoffiMeower avatar Aug 04 '24 05:08 SoffiMeower

image

SoffiMeower avatar Aug 04 '24 05:08 SoffiMeower

image Error point.

SoffiMeower avatar Aug 04 '24 05:08 SoffiMeower

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

SoffiMeower avatar Aug 04 '24 05:08 SoffiMeower

No idea what wrong here since everything looks okay.

ultimaweapon avatar Aug 04 '24 08:08 ultimaweapon

No idea what wrong here since everything looks okay.

Maybe a bug with windows-sys?

SoffiMeower avatar Aug 04 '24 16:08 SoffiMeower

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

ultimaweapon avatar Aug 04 '24 16:08 ultimaweapon

Gonna see if this magically got fixed

SoffiMeower avatar Aug 11 '24 18:08 SoffiMeower

image I mean, it's new.

SoffiMeower avatar Aug 11 '24 19:08 SoffiMeower

.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

SoffiMeower avatar Aug 11 '24 19:08 SoffiMeower

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

SoffiMeower avatar Aug 11 '24 19:08 SoffiMeower