Bug 43786 - peverify is broken again
Summary: peverify is broken again
Status: RESOLVED FIXED
Alias: None
Product: Runtime
Classification: Mono
Component: General (show other bugs)
Version: unspecified
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Ludovic Henry
URL:
Depends on:
Blocks:
 
Reported: 2016-08-26 12:35 UTC by Marek Safar
Modified: 2016-08-30 08:33 UTC (History)
5 users (show)

See Also:
Tags:
Is this bug a regression?: Yes
Last known good build:


Attachments

Description Marek Safar 2016-08-26 12:35:13 UTC
peverify any .exe

peverify x.exe
mono_os_mutex_lock: pthread_mutex_lock failed with "Invalid argument" (22)
Abort trap: 6
Comment 1 Andi McClure 2016-08-29 15:45:48 UTC
I can't repro this.

Marek, what OS, mono version etc was this?
Comment 2 Marek Safar 2016-08-29 16:22:21 UTC
Mac OS, mono master

x.cs

class X
{
	static void Main ()
	{
	}
}

mcs x.cs
peverify x.exe

mono_os_mutex_lock: pthread_mutex_lock failed with "Invalid argument" (22)
Abort trap: 6
Comment 3 Rodrigo Kumpera 2016-08-29 18:59:11 UTC
4.4 is broken and won't be fixed.

4.6 works.

Master with the following commit works:

commit dcd650d6fc59817b1efd6fc088ac41ce304a41c2
Author: Zoltan Varga <vargaz@gmail.com>
Date:   Thu Aug 25 22:18:45 2016 +0200
Comment 4 Andi McClure 2016-08-29 19:02:20 UTC
As mentioned, I was not reproducing this. This was with mono master
d185b75dd7170e2555d2bb70f7a53b54ecbf855c

I *do* reproduce this with the newest mono master
6a5599d71e3c241a4ffbd2833d4d92fe7c89afed
Comment 5 Andi McClure 2016-08-29 19:07:57 UTC
Reopening. Rodrigo, if you are still not reproducing this after upgrading to 6a5599d, let me know.
Comment 6 Andi McClure 2016-08-29 19:23:24 UTC
The crash occurs because scan_mutex is not valid when pedump calls mono_init_version and wapi_init is called.

In between d185b75dd and 6a5599d71e is e5a4d23fc7d431ddb61ad271a5b1e6ad28612104:

"[w32handle] Initialize them earlier...", a commit by ludovic

This moves mono_w32handle_init from mono_init_internal where wapi_init is called to mono_main.

However pedump does not call mono_main, it calls mono_init_version, so now mono_w32handle_init is never called. This could potentially impact anyone who uses the embedding API.

dcd650d6fc59 which Rodrigo tested is newer than e5a4d23fc so I'm not sure why Rodrigo was not reproducing the problem.
Comment 7 Andi McClure 2016-08-29 19:26:42 UTC
Ludovic, can you take a look at this?
Comment 8 Zoltan Varga 2016-08-29 20:39:17 UTC
https://github.com/mono/mono/pull/3478

It would be nice to to all of this stuff in a managed tool instead of C. Since we don't so sandboxing anymore, we don't need a verifier in the runtime.
Comment 9 Rodrigo Kumpera 2016-08-29 21:51:49 UTC
Merged Zoltan's PR.
Comment 10 Rodrigo Kumpera 2016-08-29 22:12:48 UTC
it was reverted, sorry guys :(
Comment 11 Ludovic Henry 2016-08-30 08:33:10 UTC
It is now fixed with https://github.com/mono/mono/commit/e8a221683d31cc392c46ccea67dc1ae8c6d108e7

Notice (2018-05-21): bugzilla.xamarin.com will be switching to read-only mode on Thursday, 2018-05-25 22:00 UTC.

Please join us on Visual Studio Developer Community and GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs and copy them to the new locations as needed for follow-up. The See Also field on each Bugzilla bug will be updated with a link to its new location when applicable.

After Bugzilla is read-only, if you have new information to add for a bug that does not yet have a matching issue on Developer Community or GitHub, you can create a follow-up issue in the new location. Copy and paste the title and description from this bug, and then add your new details. You can get a pre-formatted version of the title and description here:

In special cases you might also want the comments:

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Note You need to log in before you can comment on or make changes to this bug.