At 9:25 PM +0530 11/11/02, Gopal V wrote:
If memory serves me right, Dan Sugalski wrote:
 All you need to do is change the offset a bit to point to an opcode
 and you'll be fine.
Hmm... you mean to say that a jump to a non-instruction is valid ? ..
Sure. Or at least not forbidden.

We've had the verifiability question hashed out ... but jump target
validation is one of the simplest cases..... This could a serious issue
if Parrot starts using precompiled .pbc files (instead of the .pm model).
No, it's not a problem. There are two potential cases to deal with.

1) We trust the code
2) We don't trust the code

The first is the common case for us. We're either coming straight from source, or from code that we are reasonably sure is fine. In that case, why bother verifying? Sure, there may be compiler errors, but having every single invocation of bytecode check for compiler errors is a bit excessive.

The second is the less common case, but given the number of things we can't verify (it's valid to give branch and jump register args) the time spent isn't going to get you anywhere, since you need to check at runtime anyway. With a full scan of the bytecode, of course, and you'd need to figure where each and every instruction starts, which can be costly. (We can't use any table in the bytecode, as what makes that table any more valid than the code itself? :)

We're already pretty much forced to do full runtime checking, so if code branches somewhere it shouldn't when it's running in a restricted container, we'll just catch the bad access and kill the interpreter. Not much else for it, if we need to guard against the malicious, and unfortunately we do.

Also it must be relatively simple to check for right ? ... A special
option (for the sake of speed freaks ?) parrot -fverify hello.pbc ?
No, the option'd be more that you enable verification rather than disable it. Speed is the default.

Excuse my ignorance if such a thing already exists ...
Only plans, which aren't as solid as they ought be. I'll fix that.
--
                                        Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
[EMAIL PROTECTED]                         have teddy bears and even
                                      teddy bears get drunk

Reply via email to