# VM help

**URL:** <https://www.ruby-forum.com/t/vm-help/177828>\
**Category:** Ruby\
**Created:** [October 24, 2009, 7:46pm UTC](https://www.ruby-forum.com/t/vm-help/177828 "2009-10-24T19:46:39Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alexander\_Cohen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/54ee81/32.png) [@Alexander\_Cohen](https://www.ruby-forum.com/u/Alexander_Cohen)\
**Post date:** [October 24, 2009, 7:46pm UTC](https://www.ruby-forum.com/t/vm-help/177828/1 "2009-10-24T19:46:39Z")

</div>

Hello,

Can anyone out there point me to some tutorial or examples on how to  
use the Ruby VM? Most specifically, how to separate the VM into  
multiple contexts with their own set of global objects and maybe how  
to use the stack functions.

thx

AC

---

<div class="post-metadata">

**Author:** ![Alexander\_Cohen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/54ee81/32.png) [@Alexander\_Cohen](https://www.ruby-forum.com/u/Alexander_Cohen)\
**Post date:** [October 25, 2009, 10:05am UTC](https://www.ruby-forum.com/t/vm-help/177828/2 "2009-10-25T10:05:34Z")

</div>

On 10/24/2009 07:46 PM, Alexander Cohen wrote:

> Can anyone out there point me to some tutorial or examples on how to  
> use the Ruby VM? Most specifically, how to separate the VM into  
> multiple contexts with their own set of global objects and maybe how  
> to use the stack functions.

I don’t think there is an easy way to sandbox multiple contexts and  
still use global variables etc. You would at least have to hack the  
interpreter, I guess. What are you trying to accomplish?

Kind regards

robert

---

<div class="post-metadata">

**Author:** ![Alexander\_Cohen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/54ee81/32.png) [@Alexander\_Cohen](https://www.ruby-forum.com/u/Alexander_Cohen)\
**Post date:** [October 25, 2009, 7:23pm UTC](https://www.ruby-forum.com/t/vm-help/177828/3 "2009-10-25T19:23:58Z")

</div>

On Oct 25, 2009, at 5:05 AM, Robert K. wrote:

> On 10/24/2009 07:46 PM, Alexander Cohen wrote:
> 
> > Can anyone out there point me to some tutorial or examples on how  
> > to use the Ruby VM? Most specifically, how to separate the VM  
> > into multiple contexts with their own set of global objects and  
> > maybe how to use the stack functions.
> 
> I don’t think there is an easy way to sandbox multiple contexts and  
> still use global variables etc. You would at least have to hack the  
> interpreter, I guess. What are you trying to accomplish?

I am adding ruby to be used as a scripting language in WebKit/WebCore.  
It’s really working great but it’s not feasable for anything else than  
playing around if i can’t sandbox multiple contexts. I could build the  
ruby VM directly into the core and hack it for multiple contexts but i  
was hoping i would not need to do that. Are there any other options  
out there?

AC

---

<div class="post-metadata">

**Author:** ![Alexander\_Cohen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/54ee81/32.png) [@Alexander\_Cohen](https://www.ruby-forum.com/u/Alexander_Cohen)\
**Post date:** [October 25, 2009, 8:50pm UTC](https://www.ruby-forum.com/t/vm-help/177828/4 "2009-10-25T20:50:05Z")

</div>

Alexander Cohen wrote:

> I am adding ruby to be used as a scripting language in WebKit/WebCore.  
> It’s really working great but it’s not feasable for anything else than  
> playing around if i can’t sandbox multiple contexts. I could build the  
> ruby VM directly into the core and hack it for multiple contexts but i  
> was hoping i would not need to do that. Are there any other options  
> out there?

Google for “ruby sandbox” and you should find the sandbox gem - e.g.  
second hit I get is  
[http://flouri.sh/2009/4/4/how-to-set-up-the-ruby-sandbox](http://flouri.sh/2009/4/4/how-to-set-up-the-ruby-sandbox)

It’s a C extension but requires only one small patch to the ruby  
interpreter.

IIRC it was one of \_why’s projects - to skip a long (and possibly  
unfinished) story, he destroyed his own code repositories. However there  
appear to be various forks available on github.

# gem sources

\*\*\* CURRENT SOURCES \*\*\*

[http://gems.rubyforge.org/](http://gems.rubyforge.org/)  
[http://gems.github.com/](http://gems.github.com/)

# gem search --remote sandbox

\*\*\* REMOTE GEMS \*\*\*

bdimcheff-sandbox (0.1.1)  
file\_sandbox (0.5)  
nkryptic-sandbox (0.2.4)

Regards,

Brian.

---

<div class="post-metadata">

**Author:** ![Alexander\_Cohen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/54ee81/32.png) [@Alexander\_Cohen](https://www.ruby-forum.com/u/Alexander_Cohen)\
**Post date:** [October 25, 2009, 8:51pm UTC](https://www.ruby-forum.com/t/vm-help/177828/5 "2009-10-25T20:51:27Z")

</div>

Also google “ruby freaky freaky sandbox”
