Re:Lua in the Kernel?
by raverbashing on Friday September 18, 2020 @05:01AM
(#24514556)
Just add a time limit to the sandbox as well
[ Parent
| on HN ]
Apparently, the sandbox cannot enforce such a time limit.
From a similar thread to the one linked from the root comment:
> ..Attempts to control untrusted scripts may be in vain. E.g. string.find, string.rep and other C functions can be abused and will either run forever or allocate unlimited amounts of memory. This is true for both Lua and LuaJIT.
> The only reasonably safe way to handle untrusted Lua scripts is to isolate them in a process context and to make use of per-process quotas/limits provided by the operating system.
Improved functions sandboxing in Lua and LuaJIT - http://lua-users.org/lists/lua-l/2011-02/msg01106.html
This solution is problematic because there's no one time limit that makes sense across all past and present CPUs that span orders of magnitude of performance.. your lua script would always fail on some CPU and there wouldn't be a way to fix it.