[Oberon] Oberon for a C++ user.

Skulski, Wojciech skulski at pas.rochester.edu
Wed Sep 28 23:36:41 CEST 2016


Lars:
> By procedure variables do you mean a variable that can be assigned with a
> procedure type? just want to clarify what exactly they are..  i.e. in
> freepascal one can make a type, that is a procedure(someparameters), and
> then declare a variable of that type.

Yes. Basically, the procedure variable is a pointer to the entry point of some code. What makes the pointers into variables is the static type checking performed by the compiler. Once this test is passed during compilation, the code is generated that makes the assignment. Then at run time the code is executed. Now you have a pointer to some procedure which is in a module somewhere in the computer memory. This is OK, unless you unload that module. The pointer becomes dangling. If you call the procedure via that pointer, you will start execution of some memory sequence which may not be valid anymore.

In BlackBox they partly remedied the problem by not unloading the modules. Upon unloading, the unloaded module becomes a "zombie" locked in memory and can no longer be called with usual BlackBox means. But it stays in memory, in case you have some procedure variables somewhere. If you use them, you will then execute the zombi code. The BlackBox designers thought it is better to execute the zombi code rather than let the processor execute some completely random string of bytes. 

The security risk is that you can assign the procedure to the variable, and then unload the code. As you see from this discussion, this problem has not been solved yet.

Wojtek


More information about the Oberon mailing list