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)

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


Attachments

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. ***

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.