ValveSoftware / Proton

Compatibility tool for Steam Play based on Wine and additional components
Other
24.17k stars 1.06k forks source link

Multiple games crash with Ryzen 3xxx #2927

Closed kisak-valve closed 3 years ago

kisak-valve commented 5 years ago

There's some reports of users upgrading their hardware to Ryzen 3xxx processors and games that were previously working for them are now failing with SGDT instruction cannot be used by applications. in dmesg and large Proton logs that are mostly full of access violations.

This issue report is to track the general umip compatibility of that processor generation.

References: https://github.com/ValveSoftware/Proton/issues/1417#issuecomment-516725375 https://github.com/ValveSoftware/Proton/issues/2386#issuecomment-516802877 https://github.com/ValveSoftware/Proton/issues/2909#issuecomment-515681003 https://github.com/ValveSoftware/Proton/issues/2909#issuecomment-516275599

2997

Workaround: Add clearcpuid=514 as a kernel boot option to disable UMIP support.

Leopard1907 commented 5 years ago

https://www.pcgamer.com/amd-wants-destiny-2-players-to-help-test-a-beta-chipset-driver-for-third-gen-ryzen/

Windows users suffered from this , might be a similar issue.

MuchiMuchiPink commented 5 years ago

@kisak-valve hey, I saw you asking someone else for line counts for this issue. Are you still interested in this for some other game ( Devil May Cry 5)? :) grep c0000005 steam-601150.log | wc -l gives me 903 lines.

MuchiMuchiPink commented 5 years ago

Tested this with Monster Hunter World. Same result "MonsterHunterWo[11594] ip:14dc8d588 sp:227108: SGDT instruction cannot be used by applications." in dmesg

vandergail commented 5 years ago

Ryzen 3700X owner. Just installed Fedora 30 today with an updated iso to get around the rdrand instruction bug affecting systemd. Both Monster Hunter World (582010) and Resident Evil 2 (883710) crash at launch. Proton log is 63MB for Monster Hunter World and 1.1GB for Resident Evil 2.

Same results in dmesg: MonsterHunterWo[5868] ip:14dc8d588 sp:227108: SGDT instruction cannot be used by applications. re2.exe[7974] ip:15330398d sp:527338: SGDT instruction cannot be used by applications.

MuchiMuchiPink commented 5 years ago

I found this, if this helps.

umip is one Intel security function, which protect(#GP exception)
  below instructions in user mode:
    * SGDT - Store Global Descriptor Table
    * SIDT - Store Interrupt Descriptor Table
    * SLDT - Store Local Descriptor Table
    * SMSW - Store Machine Status Word
    * STR - Store Task Register
jalabb commented 5 years ago

Ryzen 3700X, Wolfenstein Youngblood : grep c0000005 steam-1056960.log | wc -l gives 152 lines. grep exception steam-1056960.log | wc -l gives 907 lines. [ 9920.972119] umip: Youngblood_x64v[25225] ip:14d481e87 sp:327358: SGDT instruction cannot be used by applications. I tried GTA V, no problem.

Vash63 commented 5 years ago

Found some googling on that exception that indicates this shouldn't be generating an exception at all: "For instance, programs running on WineHQ and DOSEMU2 rely on some of these instructions to function. ... In order to not change the behavior of the system (i.e., a SIGSEGV signal should not be generated when using these instructions), this implementation traps the #GP fault generated by the CPU and emulates SGDT, SIDT and SMSW. with dummy returned values."

It seems like this feature of UMIP may not be working.

joeknock90 commented 5 years ago

I believe this issue is also happening on the Epic Games store version of Metro Exodus (in case that helps at all) I'm also experiencing it with Shadow of the Tomb raider.

jarrard commented 5 years ago

And here I have my shiny new 3600 next to me, ready to install sometime next week... sigh.

shmerl commented 5 years ago

AMD pushed out updates to AGESA that fixes RDRAND issue (for example Asrock X570 Taichi got it already). Is SGDT problem related too?

jarrard commented 5 years ago

Yeah my board has AGESA 1.0.0.3 ABB update recently. Hope thats the one.

shmerl commented 5 years ago

Please post if it fixes that for you or not.

jarrard commented 5 years ago

I won't know until sometime next week, believe it or not I'm waiting for this new thermal paste to show up before I install the 3600. Bios is updated in preparation non the less.

jalabb commented 5 years ago

I updated the BIOS on my Asus Prime B450M-A to version 1804 Update AGESA 1.0.0.3 Patch AB to improve compatibility; It doesn't help with Wolfenstein Youngblood.

shmerl commented 5 years ago

@poke86: same SGDT issue? Can you please report it to AMD directly? I'm still waiting for my new CPU, so can't do it yet.

grigorig commented 5 years ago

UMIP provides fixups/fallbacks for certain instructions, including SGDT. However, this excludes processes in long mode (i.e. 64 bit applications). See the documentation here:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/x86/kernel/umip.c#n289

So, as far as I can see, everything works as it should and the game or wine is at fault here.

shmerl commented 5 years ago

everything works as it should and the game or wine is at fault here.

But they apparently work with older Zen processors, and only Zen 2 is a problem. Why is that?

MuchiMuchiPink commented 5 years ago

I flashed my Gigabyte board today with the AGESA 1.0.0.3 update (F42a) and still the same.

jarrard commented 5 years ago

have you guys also tried to roll back to proton 4.2-9? 4.11-1 has some issues.

grigorig commented 5 years ago

That's a good question, but as far as I can tell, Zen 2 is the first AMD architecture to support UMIP. Does anyone know which Intel CPU architectures support it?

Edit: it certainly isn't available (or enabled) on my Skylake system even though support for it is compiled into the kernel. You can check with dmesg | grep UMIP. It should print "x86/cpu: User Mode Instruction Prevention (UMIP) activated" if it is enabled.

jalabb commented 5 years ago

have you guys also tried to roll back to proton 4.2-9? 4.11-1 has some issues.

I tried it with 4.2-9 and 3.16-9 before 4.11-1 came out and it doesn't change anything, for Youngblood at least.

MuchiMuchiPink commented 5 years ago

Yeah, I tried older versions of Proton too.

Berobad commented 5 years ago

Edit: it certainly isn't available (or enabled) on my Skylake system even though support for it is compiled into the kernel. You can check with dmesg | grep UMIP. It should print "x86/cpu: User Mode Instruction Prevention (UMIP) activated" if it is enabled.

Nothing on Ryzen 2000 too.

Has someone tried a custom kernel with UMIP disabled?

CONFIG_X86_INTEL_UMIP=n or Processor type and feature - Intel User Mode Instruction Prevention

btw the feature isn't available if you disable support for Intel CPUs in the kernel

grigorig commented 5 years ago

There also is a chance that UMIP is disabled by firmware/BIOS on many (older?) mainboards and notebooks even though the CPU technically supports it. It's hard to find information about this feature.

Termuellinator commented 5 years ago

It seems "clearcpuid=514" in the Bootoptions should disable UMIP without the need to compile a custom kernel - maybe some zen2 owner could test it?

jalabb commented 5 years ago

Maybe Valve could put up a kernel with UMIP disabled on their PPA, like they did for fsync?

laichiaheng commented 5 years ago

Has anyone tried the clearcpuid=514 boot option? I can't test it, because I can't reboot now.

maverck commented 5 years ago

i am willing to try but do not know how, can you elaborate on where i add that?

Termuellinator commented 5 years ago

when using grub: https://askubuntu.com/questions/19486/how-do-i-add-a-kernel-boot-parameter

i wouldn't make it permanent, but just try it for one boot by pressing "e" and adding it there :)

grigorig commented 5 years ago

It looks like the first Intel CPU architecture to support UMIP is Cannonlake. Cannonlake doesn't really exist in practice, so it's not a surprise that nobody has noticed the issue yet.

maverck commented 5 years ago

So i added clearcpuid=514 to my grub and booted and Monster Hunter World launched correctly. It does seem like this is the cause. Edit - Assassin's Creed Odyssey also works now. I am currently running a r9 3900x, 1080ti on pop os

jalabb commented 5 years ago

Great, thank you! I'll try it for Wolfenstein Youngblood when I get home... In 10 hours or so ^^

abnazhor commented 5 years ago

Is there a way to use this fix without having grub?

ashmonger commented 5 years ago

Is there a way to use this fix without having grub?

How come you use linux without grub? Are you from the stone age and still use LiLo?

BTW: I'll try the grub tweak tonight, and give soem feedback about it.

laichiaheng commented 5 years ago

Is there a way to use this fix without having grub?

How come you use linux without grub? Are you from the stone age and still use LiLo?

Maybe systemd-boot?

laichiaheng commented 5 years ago

Can anyone try it with Resident Evil 2 Remake, I have to wait for 26 hours to test it.

ashmonger commented 5 years ago

Is there a way to use this fix without having grub?

How come you use linux without grub? Are you from the stone age and still use LiLo?

Maybe systemd-boot?

Does he use Arch? (since centos/debian/ubuntu/fedora still use grub2)

abnazhor commented 5 years ago

@ashmonger I use Solus, and it doesn't use grub, in theory it uses goofiboot.

MuchiMuchiPink commented 5 years ago

It works with MHW and DMC 5. Should work with RE2, too. Thanks.

laichiaheng commented 5 years ago

Is there any benefit to use non-grub2 bootloader?

stalkerg commented 5 years ago

Looks like it's the kernel bug wine or any program shouldn't know this protection and use the empty table. Probably after that https://marc.info/?l=linux-msdos&m=147876036616306&w=2 they remove the original approach.

Termuellinator commented 5 years ago

I'm not sure that this is a kernel bug, as the point of UMIP is to prevent userspace calling this functions. I think it's more wine/proton bug that the blocked call yields a crash?

joeknock90 commented 5 years ago

Confirming that adding clearcpuid=514 to kernel boot options now allows Shadow of the Tomb Raider AND Metro Exodus to boot for me.

I had started a wine bug report about this not knowing what the cause was originally.

I've updated with this info.

https://bugs.winehq.org/show_bug.cgi?id=47571

joeknock90 commented 5 years ago

Is there a way to use this fix without having grub?

You'll have to search how to append kernel parameters to whatever boot loader you are using.

Termuellinator commented 5 years ago

Just to be clear, because it seems that some take this as a solution: UMIP is a security feature and disabling it is a workaround at best. Plus, there is a chance that "clearcpuid" will be removed as a boot option in future kernels.

shmerl commented 5 years ago

For anyone interested why it's 514, see here. It's surely not a solution, but a workaround.

jarrard commented 5 years ago

Hope a proper fix turns up soon.

shmerl commented 5 years ago

From here: https://lwn.net/Articles/738209/

When enabled, however, UMIP will change the behavior that certain applications expect from the operating system. For instance, programs running on WineHQ and DOSEMU2 rely on some of these instructions to function. [...] In order to not change the behavior of the system (i.e., a SIGSEGV signal should not be generated when using these instructions), this implementation traps the #GP fault generated by the CPU and emulates SGDT, SIDT and SMSW. with dummy returned values. This should be sufficient to not break the applications mentioned above.

Does this mean that workaround is broken and Wine is expecting something else?

jalabb commented 5 years ago

Wolfenstein Youngblood runs after applying the workaround.

Vash63 commented 5 years ago

From here: https://lwn.net/Articles/738209/

When enabled, however, UMIP will change the behavior that certain applications expect from the operating system. For instance, programs running on WineHQ and DOSEMU2 rely on some of these instructions to function. [...] In order to not change the behavior of the system (i.e., a SIGSEGV signal should not be generated when using these instructions), this implementation traps the #GP fault generated by the CPU and emulates SGDT, SIDT and SMSW. with dummy returned values. This should be sufficient to not break the applications mentioned above.

Does this mean that workaround is broken and Wine is expecting something else?

I posted this as comment 7 on this thread, based on the error giving a general protection fault it would appear this workaround isn't in place at all - note that that patch was written by an Intel employee, it may be that it was only applied to Intel processors featuring UMIP and AMD hasn't gotten to including theirs in the same workaround.

It's also possible that since this was written the plan changed. I think we would need someone with an Intel Cannon Lake CPU to verify if this is an AMD specific issue or not, as I don't believe any Intel CPUs older than Cannon Lake support UMIP.