Crashing Squeak Smalltalk is easy—or is it?
Fri 18 Dec 2020 09:40 CET
Recently on HN,
rbanffy brought up a form of the old chestnut about crashing the
image by simply executing
true become: false.
It turns out it’s no longer true!
In the latest Squeak,
doesn’t work – the compiler complains that you can’t assign into a read-only variable. So let’s try this:
But now the metaprogramming system complains you’re trying to modify a read-only binding! So we view source on ClassBinding»value:, and see that a resumable exception is being used to guard the modification, so let’s explicitly signal that we really want to modify that binding:
Finally! Now, evaluating
But the image keeps running! Use of the literal class
True seems to
be rare enough that things are OK for at least several minutes after
Doing this, however, definitely should immediately torpedo things:
… huh. It didn’t work. It used to! Again, on this current Squeak
version, we see a different behaviour. This time, it says
execute #elementsExchangeIdentityWith: on read-only object #(false).
So we’ll have to try harder:
That doesn’t work either! Same error as for
Welp, I’m actually all out of ways to crash this modern image in analogous ways to the easy pitfalls of images of yesteryear…
P.S. Running the following command,
True := False, definitely does have an analogous
effect on a similarly-“alive” Unix image :-) . I just tried it on a
scratch VM; the results are pretty intimidating!