[Mono-devel-list] [PATCH] Warn on lock (string) or lock (typeof (Foo))
bmaurer at ximian.com
Fri May 27 15:43:11 EDT 2005
The attached patch makes mcs emit an added-value warning: it warns when
you lock on a string or System.Type.
For those who are not aware of why this is a problem, there are a few
* Strings and Types (can be) shared across app domains. So,
locking on a type might actually lock stuff across multiple app
domains. In most cases you do not want this.
* Strings are interned. That means that it is possible to have two
people using the same magic string (either by mistake or because
malicious code is attempting to create a deadlock).
* Public types could be locked by other code (again, either by
mistake or by malicious code)
spouliot reports at least one real-live ssl bug due to locking on
strings. I am sure this patch will catch others.
I'd also propose that we mark this warning to be an error for the `mcs'
module, ensuring there are no regressions of the mini-audit I've done.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 1161 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20050527/e5464655/attachment.bin
More information about the Mono-devel-list