Is Wrapping Safe? [Re: Is Set growth thread-safe?]
Peter Crowther
Peter at ozzard.org
Thu Sep 22 22:01:59 UTC 2005
> From: [...] jwalsh at bigpond.net.au
> Thanks Ross, you have given me the partial answer to a
> problematic which has bugged me for a while:
> It started off as "Is Smalltalk safe from Windows?",
> Then progressed to "Is Smalltalk safe from 'C' ?",
> Now its "Is Smalltalk Safe from Smalltalk".
> This was originally a problem which could not ever happen to
> Smalltalk.
> Encapsulation and Message passing meant the Method was safe,
> from intrudere.
... it's not. Object has plenty of debugging methods for poking at
slots on arbitrary objects. It's relatively simple to overwrite a
CompiledMethod's bytecodes and even simpler just to replace the method
with one you compile up. There is nothing mystical about objects;
they're just data. In order to run a debugger, *something* has to break
encapsulation.
> Can someone please convince me that Smalltalk is safe from
> 'C' hackers.
On the contrary, I can convince you the other way. Object memory in
Smalltalk is merely bytes at locations in memory; the VM uses a
C-language stack for some of its work, which can be attacked; and the
virtual machine is a chunk of compiled C. If the VM can do it,
attacking code can do it; and the VM is the only way of creating any
effect in Smalltalk. Therefore, all the effects that you see in
Smalltalk can be duplicated by C code, because they are *created* by C
code. There is nothing mystical about objects, image, or anything else.
- Peter
More information about the Squeak-dev
mailing list
|