Bug 58168 - pedump incorrectly reports mscorlib as invalid
Summary: pedump incorrectly reports mscorlib as invalid
Status: RESOLVED FIXED
Alias: None
Product: Runtime
Classification: Mono
Component: Verifier (show other bugs)
Version: master
Hardware: PC Mac OS
: --- normal
Target Milestone: Future Cycle (TBD)
Assignee: Rodrigo Kumpera
URL:
: 56608 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-07-14 16:48 UTC by Mike Voorhees
Modified: 2017-08-16 05:04 UTC (History)
7 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

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.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Mike Voorhees 2017-07-14 16:48:19 UTC
If you run `pedump --verify metadata,code` on mscorlib.dll, it will report the assembly as invalid because of 

Error: Invalid CustomAttribute content row 10 Value field 0x00016594
Error: CustomAttribute: Invalid class parameter type :DebuggingModes 
Error count: 2

If you copy the same mscorlib.dll to windows and run peverify on it, peverify says the dll is perfectly fine.

I hit this using unity's fork of mono 2017-02.

I used the same pedump from 2017-02, but ran it on an mscorlib.dll from mono 2.10 and a similar error is reported

Error: Invalid CustomAttribute content row 0 Value field 0x0001c5f1
Error: CustomAttribute: Invalid class parameter type System.Runtime.ConstrainedExecution:Consistency 
Error count: 2
Comment 1 Ludovic Henry 2017-07-20 14:47:20 UTC
I can reproduce on macOS 10.12 + mono 5.4

To reproduce run the following command:

> pedump --verify metadata,code /Library/Frameworks/Mono.framework/Versions/Current/lib/mono/4.5/mscorlib.dll

The output is the following:

> you are registering twice the same counter address
> you are registering twice the same counter address
> you are registering twice the same counter address
> Error: Invalid CustomAttribute content row 3 Value field 0x00028bd9
> Error: CustomAttribute: Invalid class parameter type :DebuggingModes
> Error count: 2

Thank you for the report!
Comment 2 Zoltan Varga 2017-07-30 19:47:02 UTC
This happens because mono_is_corlib_image () returns FALSE for the corlib we are verifying, and this is used to set the klass->valuetype and klass->enumtype  bits, so they are set incorrectly for some types.
Comment 3 Rodrigo Kumpera 2017-08-15 22:04:48 UTC
https://github.com/mono/mono/pull/5382
Comment 4 Rodrigo Kumpera 2017-08-15 22:07:47 UTC
*** Bug 56608 has been marked as a duplicate of this bug. ***