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

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