hyperlight-dev / hyperlight

Hyperlight is a lightweight Virtual Machine Manager (VMM) designed to be embedded within applications. It enables safe execution of untrusted code within micro virtual machines with very low latency and minimal overhead.
Apache License 2.0
2.21k stars 74 forks source link

Add example involving JavaScript guest functions #46

Open cloudspeech opened 3 weeks ago

cloudspeech commented 3 weeks ago

I am intrigued by this project, but can't help noting the lack of even remotely real-life examples. JavaScript is a popular choice for FaaS providers, cf. https://blog.cloudflare.com/introducing-cloudflare-workers/.

How about a worked example using e.g. Bellard's QuickJS?

Even if it showed only how to run user-defined math functions under Hyperlight, it would go a long way towards more realism.

Notes on how to add networking would be a big plus, of course.

jeromegn commented 3 weeks ago

I would also be interested in this.

I just played with hyperlight, but I couldn't get anything useful for running untrusted code in it. The no-std and "no libc" requirements prevent a lot of use cases. Out of the box, I wasn't able to get deno or rquickjs to compile under these conditions. I think rhai might be workable.

kumargu commented 2 weeks ago

On similar lines, can we have examples of JAVA guest functions? I saw the C execution of guest functions needed a FFI calls, do we need JNI bindings to call JAVA code?