Bug 324864 (MONO82194) - [PATCH]Assembly.GetTypes with generics causes SIGSEGV
Summary: [PATCH]Assembly.GetTypes with generics causes SIGSEGV
Status: RESOLVED FIXED
Alias: MONO82194
Product: Mono: Runtime
Classification: Mono
Component: generics (show other bugs)
Version: 1.2
Hardware: Other Other
: P3 - Medium : Normal
Target Milestone: ---
Assignee: William Holmes
QA Contact: Martin Baulig
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-07-26 17:15 UTC by William Holmes
Modified: 2007-09-15 21:24 UTC (History)
0 users

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
Sample Code (392 bytes, text/plain)
2007-07-26 17:16 UTC, Thomas Wiest
Details
Sample Code (370 bytes, text/plain)
2007-07-26 17:16 UTC, Thomas Wiest
Details
proposed patch - make check approved ;) (1.70 KB, patch)
2007-07-26 17:23 UTC, Thomas Wiest
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Wiest 2007-09-15 20:45:26 UTC


---- Reported by billholmes54@gmail.com 2007-07-26 10:15:58 MST ----

Steps to reproduce the problem:
1. Download attached sample files
2. gmcs MyLib.cs -t:library
3. gmcs runner.cs
4. mono runner.exe

Actual Results:
SIGSEGV

Expected Results:
MyLib.ObjectContainer`1[T]
MyLib.DocumentObject
MyLib.DomainObject

This is a bug that has show up in the last week and is in the 1.2.5 branch.

I have also created and attached a patch for mono_type_create_from_typespec.  

The crash occurs in mono_generic_class_get_class when gclass is
dereferenced.  This occurs because mono_type_create_from_typespec adds a
type to the image’s typespec_cache hash table that is not completely
initialized.  Then the call to init the type do_mono_metadata_parse_type
causes mono_type_create_from_typespec to be called again later for the same
type spec for this case.  The type is found in the hash map, still not
initialized, and is simply returned on line 4156.  This later causes a
crash in mono_type_create_from_typespec.

My proposed patch is in mono_type_create_from_typespec to not add the type
to the hash map until after the call to do_mono_metadata_parse_type has
succeeded.  But before I add the type to the hash map I check to be sure it
has not already been added recursively.  If is has been added I free the
locally created type object and return the type that was found.

Please let me know if this is ok to commit.  (holmes IRC)



---- Additional Comments From billholmes54@gmail.com 2007-07-26 10:16:23 MST ----

Created an attachment (id=172347)
Sample Code




---- Additional Comments From billholmes54@gmail.com 2007-07-26 10:16:38 MST ----

Created an attachment (id=172348)
Sample Code




---- Additional Comments From billholmes54@gmail.com 2007-07-26 10:23:25 MST ----

Created an attachment (id=172349)
proposed patch - make check approved ;)




---- Additional Comments From lupus@ximian.com 2007-07-31 13:45:54 MST ----

*** https://bugzilla.novell.com/show_bug.cgi?id=MONO82246 has been marked as a duplicate of this bug. ***



---- Additional Comments From billholmes54@gmail.com 2007-07-31 14:57:39 MST ----

committed to trunk r83127.
committed to 1.2.4 branch r83128.
Will commit a test case to trunk soon.



---- Additional Comments From sebastien@ximian.com 2007-08-01 10:02:01 MST ----

The applied patch has broken the CAS tests on the x86 bot
http://mono.ximian.com/monobuild/builds/HEAD/sles-9-i586/mono/83139/logs/test-cas.log



---- Additional Comments From sebastien@ximian.com 2007-08-01 10:38:35 MST ----

oops, wrong alarm. the failures are due to the permview update (and I
forgot to include mcs in the binary search)



---- Additional Comments From billholmes54@gmail.com 2007-08-01 15:29:36 MST ----

Test added at r83233

Imported an attachment (id=172347)
Imported an attachment (id=172348)
Imported an attachment (id=172349)

Unknown bug field "cf_op_sys_details" encountered while moving bug
   <cf_op_sys_details>SUSE 10.2</cf_op_sys_details>
Unknown operating system other. Setting to default OS "Other".