doitsujin / dxvk

Vulkan-based implementation of D3D9, D3D10 and D3D11 for Linux / Wine

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

mingw-w64-binutils 2.34 causes crashes in DXVK

wgpierce opened this issue · comments

If DXVK is compiled with mingw-w64-binutils 2.34, DXVK crashes in various different ways.

mingw-w64-binutils 2.33 does not have this problem. binutils master also does not have this problem. mingw-w64-binutils 2.34-1 is the current version in ArchLinux repos. I'm bisecting this now.

Filing an issue to keep track of the various occurrences of this in various games.

Software information

Bayonetta, various others

System information

  • GPU: RTX 2080
  • Driver: Nvidia 440.66.12-1
  • Wine version: proton-tkg-5.8
  • DXVK version: 1.6.1 or master 6643c75

Apitrace file(s)

N/A

Log files

Wine crashes on

wine: Unhandled page fault on write access to 00000000 at address 00314BAD (thread 00c4), starting debugger...

or various other symptoms such as #1622

I've bisected this to be broken by binutils commit
ea933f17c3c6b9fa1daf8d03baa34f7bec855d6c: "Release bfd_alloc memory in bfd_check_format_matches"
between 2.33 and 2.34 release branches

and fixed by binutils commit
b03202e32c8235997b3485b0b4655926ad97a1cc: "bfd_get_size cache"
between 2.34 and master.

Can anyone afflicted by this problem try with the attached DXVK build to confirm binutils master fixes the problem for you? I only have one data point myself.
Attached is DXVK master compiled against binutils master (compiled as mingw-w64-binutils).
dxvk-master_binutils-master.tar.gz

I've filed a bug with binutils upstream: https://sourceware.org/bugzilla/show_bug.cgi?id=25993
More debug details are there.

I've got a tinderbox available for testing, I'll give it a try to reproduce this and also to test the patch.

TLDR on the issue is that there's a memory corruption bug that could show itself as a variety of symptoms. The bisection I did before was probably just perturbing the bug in different ways rather than actually introducing/fixing it.

There's a proposed patch on the binutils bug that seems to fix the issue. Attached is a PKGBUILD for anyone on ArchLinux who wants to try it out. Rename it to PKGBUILD.
PKGBUILD.txt

This is now in the latest master of binutils.

Well, there's actually three individual patches that need backporting to the 2.34 branch. With binutils-2.35 on the horizon, it's not very likely upstream will take the toll on it to update the old 2.34 branch. I mean, prove me wrong, but as of writing this it's best advice for everyone to avoid 2.34 and stick to 2.33.1 or wait for 2.35

Or just use master

Unless you're a toolchain dev you shouldn't depend on any live or master branch of toolchain. Been there, done that: wasting time and many cpu cycles.

@stefson only the first commit would need to be backported to fix the problem.
It's included in my PKGBUILD and it's also in TkG's builds:
Frogging-Family/mostlyportable-gcc@54890d1
Frogging-Family/mingw-on-arch-automator@9c9fe42

@stefson any results from your testing?

can anybody check this? mingw-w64-binutils-2.34-PKGBUILD-git-source

this patch seems to backport all three commits from binutils #25993 to the 2.34 branch?

yes, but of course an official backport or 2.35 would be better

this patch seems to backport all three commits from binutils #25993 to the 2.34 branch?

nevermind, I took the patch and removed the gdb and Changelog bits to apply on top of binutils-2.34-r1 (gentoo user here), and I've got a set of smothly working dxvk-1.7 libs

@stefson thanks you
i also grab binutils-2_34-branch into cumulative patch from tag-2.34 to 20200521
for applying directly into https://ftp.gnu.org/gnu/binutils/binutils-2.34.tar.gz
only first and last commit was edited (keep dev-mode turn off and for version editing only on last)
also 924adcb1d4836a08b254404350220b67332e7647 is huge (be careful)

mingw-w64-binutils-2.34-PKGBUILD-release-source

upd. well, checking 42 thousand text strings for a human is a bit unacceptable, so it might be better to use the following script to get binutils-2_34-branch.patch

binutils-2_34-branch-generator.sh

#!/bin/sh
cd "`dirname \"$0\"`"
#clear place for re-gen
[[ -d gen ]] && rm -r gen
mkdir gen && cd gen
git clone https://sourceware.org/git/binutils-gdb.git
cd binutils-gdb
git checkout -b binutils-2_34-branch
git checkout cb5f6a3e146cc70bc2d864989386df80acec5d3e
git clean -xdf
git format-patch -136 HEAD -o ../patches
cd ../patches
mv 0136-Automatic-date-update-in-version.in.patch 0136-Automatic-date-update-in-version.in-current.patch
rm *-Automatic-date-update-in-version.in.patch
sed -i '/^-#define BFD_VERSION_DATE /s/20200520/20200201/' 0136-Automatic-date-update-in-version.in-current.patch
patch 0001-Re-enable-development.patch << 'EOM'
@@ -5,2 +5,4 @@
 
+keep development-mode and pot files
+
 ---
@@ -130,28 +132,2 @@
  
-diff --git a/bfd/development.sh b/bfd/development.sh
-index 32be4b9460..6bbed41d6d 100644
---- a/bfd/development.sh
-+++ b/bfd/development.sh
-@@ -16,7 +16,7 @@
- # along with this program.  If not, see <http://www.gnu.org/licenses/>.
- 
- # Controls whether to enable development-mode features by default.
--development=false
-+development=true
- 
- # Indicate whether this is a release branch.
- experimental=false
-diff --git a/bfd/po/bfd.pot b/bfd/po/bfd.pot
-index 9c457c3d91..501bc01088 100644
---- a/bfd/po/bfd.pot
-+++ b/bfd/po/bfd.pot
-@@ -8,7 +8,7 @@ msgid ""
- msgstr ""
- "Project-Id-Version: PACKAGE VERSION\n"
- "Report-Msgid-Bugs-To: bug-binutils@gnu.org\n"
--"POT-Creation-Date: 2020-02-01 11:49+0000\n"
-+"POT-Creation-Date: 2020-02-01 12:57+0000\n"
- "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
- "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
- "Language-Team: LANGUAGE <LL@li.org>\n"
 diff --git a/bfd/version.m4 b/bfd/version.m4
@@ -673,15 +649,2 @@
  
-diff --git a/opcodes/po/opcodes.pot b/opcodes/po/opcodes.pot
-index 03a490aca8..8eb388e677 100644
---- a/opcodes/po/opcodes.pot
-+++ b/opcodes/po/opcodes.pot
-@@ -8,7 +8,7 @@ msgid ""
- msgstr ""
- "Project-Id-Version: PACKAGE VERSION\n"
- "Report-Msgid-Bugs-To: bug-binutils@gnu.org\n"
--"POT-Creation-Date: 2020-02-01 11:49+0000\n"
-+"POT-Creation-Date: 2020-02-01 12:58+0000\n"
- "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
- "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
- "Language-Team: LANGUAGE <LL@li.org>\n"
 -- 
EOM
cat *.patch > ../0001-binutils-2_34-branch.patch
cd ..
sha256sum 0001-binutils-2_34-branch.patch > 0001-binutils-2_34-branch.patch.sha256
exit 0

This is the patch I've been using for gentoo, with sys-devel/binutils-2.34-r1 patchset v4: 0059-PR-25993-Backport-from-mainline_v1.patch.gz

Gentoo doesn't use a complete git checkout, it uses the stable release and adds an own patchset on top of it with cherry picked commits from the branch, therefore the gdb parts and the Changlog's had to be removed by me.

Only the cross binutils needed the patch.

If you are the author of the backport, please post it to https://sourceware.org/bugzilla/show_bug.cgi?id=25993 , so that it can be merged into the 2.34 branch

https://sourceware.org/bugzilla/show_bug.cgi?id=25993#c16

Fix is applied to 2.34 branch, but the .tar.gz source downloads from https://ftp.gnu.org/gnu/binutils/ likely won't be updated, so Arch and other distros that use those downloads won't get the fix in 2.34. You'd have to use you use the binutils-2_34-branch git branch to get it.

But binutils 2.35 will have this fix and is planned to be released in a month's time.

upd for getting binutils-2.34 to 20200604 patch

binutils-2_34-branch-generator.sh

#!/bin/sh
cd "`dirname \"$0\"`"
#clear place for re-gen
[[ -d gen ]] && rm -r gen
mkdir gen && cd gen
git clone https://sourceware.org/git/binutils-gdb.git
cd binutils-gdb
git checkout -b binutils-2_34-branch
git checkout df18dbcfcee71422043af6f89d90f74c533d3983
git clean -xdf
git format-patch -151 HEAD -o ../patches
cd ../patches
mv 0151-Automatic-date-update-in-version.in.patch 0151-Automatic-date-update-in-version.in-current.patch
rm *-Automatic-date-update-in-version.in.patch
 # Turn off development mode (-Werror, gas run-time checks, date in sonames)
sed -i '/^-#define BFD_VERSION_DATE /s/20200604/20200201/' 0151-Automatic-date-update-in-version.in-current.patch
patch 0001-Re-enable-development.patch << 'EOM'
@@ -5,2 +5,4 @@
 
+keep development-mode
+
 ---
@@ -130,15 +132,2 @@
  
-diff --git a/bfd/development.sh b/bfd/development.sh
-index 32be4b9460..6bbed41d6d 100644
---- a/bfd/development.sh
-+++ b/bfd/development.sh
-@@ -16,7 +16,7 @@
- # along with this program.  If not, see <http://www.gnu.org/licenses/>.
- 
- # Controls whether to enable development-mode features by default.
--development=false
-+development=true
- 
- # Indicate whether this is a release branch.
- experimental=false
 diff --git a/bfd/po/bfd.pot b/bfd/po/bfd.pot
EOM
cat *.patch > ../0001-binutils-2_34-branch.patch
cd ..
sha256sum 0001-binutils-2_34-branch.patch > 0001-binutils-2_34-branch.patch.sha256
exit 0

most likely there won't be another point release of the binutils-2.34 branch, so distros have to backport the fix or people have to fix the bug locally.

On Arch Linux, mingw-w64-binutils 2.35 is available now and was even adopted into the community repository.
Ubuntu 19 has 2.33 which doesn't exhibit the issue, and 20 and 21 still only have 2.34.

gentoo has this fixed in sys-devel/binutils-2.34-r2 just yesterday I believe

Closing this because 2.35 is out now.