Bootstrapped VM doing file IO

Brian Rice water at tunes.org
Mon May 24 10:39:30 PDT 2004


Cool, thank you.

On May 24, 2004, at 2:33 AM, John Leuner wrote:

> This patch makes it possible to do a fileIn of a simple input file with
> the bootstrapped VM.
>
> Some caveats:
>
> - I used the fopen / fread functions which take a FILE* pointer as a
> handle. I did this because I was copying the Console read/write
> functions.
>
> I think this is potentially a bad thing because if someone were to
> manipulate the handle they could easily corrupt the VM or bypass any
> security system.

Actually, the Flow framework has a struct for this which provides a 
level of indirection and is harder to guess (I'll adapt the code to 
that). Still, the security hole is definitely an issue.

It's "capability"-like as a security model. We just need to make sure 
that normal uses don't hand out the handle, and then later on introduce 
ways of checking this when compiling. Perhaps a subjective layer would 
be enough, but this is speculation.

> - I created a FileObject to dispatch the primitives on. There is
> probably a better name/place for this.

FileTraits, more likely.

> - I haven't done any error checking, checks for partial reads/writes 
> etc
>
> - I'm not clear on how the positionable streams are intended to work, I
> simply implemented the position methods as fseek/ftell.

Those are sufficient.

> - In all the places where I use (integer >> 1) I should probably be
> using a macro

ObjectPointer_asSmallInt, an inline method (er, C function).

--
Brian T. Rice
LOGOS Research and Development
http://tunes.org/~water/




More information about the Slate mailing list