J
Joannes Vermorel
I would like to know if the here below 'MyClass' is threadsafe. In other
word, is reference affectation an "atomic operation" for the CLR ?
class MyClass
{
object obj = null;
public void Set(object obj) { this.obj = obj; }
public object Get() { return obj; }
}
If reference affectation is an atomic operation, then everything seems fine
to me. <guess>If not, that means that potentially I can retrieve an
inconsistence reference, i.e. a reference pointing some random part of
memory ? Using idea similar to the buffer overflow, the possibility of
"inconsistent" reference could be exploited as a security hole.</guess>
So I see 3 possible situations, reference affectation:
- is atomic.
- is not atomic and could be exploited as a security hole.
- is not atomic but some mecanism that I do not understand (yet) still
maintains the security.
Does someone has any idea on this problem ?
Thanks,
Joannes
word, is reference affectation an "atomic operation" for the CLR ?
class MyClass
{
object obj = null;
public void Set(object obj) { this.obj = obj; }
public object Get() { return obj; }
}
If reference affectation is an atomic operation, then everything seems fine
to me. <guess>If not, that means that potentially I can retrieve an
inconsistence reference, i.e. a reference pointing some random part of
memory ? Using idea similar to the buffer overflow, the possibility of
"inconsistent" reference could be exploited as a security hole.</guess>
So I see 3 possible situations, reference affectation:
- is atomic.
- is not atomic and could be exploited as a security hole.
- is not atomic but some mecanism that I do not understand (yet) still
maintains the security.
Does someone has any idea on this problem ?
Thanks,
Joannes