https://bugs.winehq.org/show_bug.cgi?id=47782
Bug ID: 47782 Summary: Segmentation fault and exceptions using ManagementClass Product: Wine Version: 4.15 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: -unknown Assignee: wine-bugs@winehq.org Reporter: dridi.boukelmoune@gmail.com Distribution: ---
Originally reported on Fedora's bugzilla for Wine 4.12 (Fedora includes wine-staging) and still happening with Wine 4.15, I'm now throwing the towel as I failed to debug this by myself. I'm interested in commit hashes if a fix is merged, and general pointers on how to deal with this in the future. For example I couldn't get a full back trace when building the master branch and never managed to print arguments up the stack with WineDbg.
https://bugzilla.redhat.com/show_bug.cgi?id=1734794
I can reliably reproduce the C# exceptions and the segfault on my system (either using Fedora packages or building the master branch with or without wine-staging):
$ cat test.cs using System; using System.Management;
class Test { static void Main(string[] args) { ManagementClass mc = new ManagementClass(args[0]); ManagementObjectCollection moc = mc.GetInstances(); foreach (ManagementObject mo in moc) { Console.Write("{0}\n", mo); foreach (PropertyData pd in mo.Properties) Console.Write("\t{0} => {1}\n", pd.Name, pd.Value); } moc.Dispose(); mc.Dispose(); } } $ mcs /reference:System.Management.dll test.cs $ ./test.exe Win32_OperatingSystem # OK $ ./test.exe Win32_PhysicalMemory # OK $ ./test.exe Win32_SoundDevice # OK $ ./test.exe Win32_Processor # System.InvalidCastException $ ./test.exe Win32_VideoController # System.InvalidCastException $ ./test.exe Win32_DesktopMonitor # System.InvalidCastException $ ./test.exe Win32_DisplayControllerConfiguration # SIGSEGV
The problem on the current master branch is the same as when I first reported the segfault to Fedora, except that things moved around a bit:
0x0000000067753b3e build_relpath+0x37 [dlls\wbemprox\query.c:866] in wbemprox: movq (%rax),%rax 866 struct table *table = view->table[table_index];
Again, view->table is null when test.exe is run with Win32_DisplayControllerConfiguration, and for other paths the results are the same (no regression nor improvement).
Obviously my testing is not comprehensive, there may be other problematic management paths but those are the ones I came across. I will happily test patches if requested.