News for hackers. Stuff that matters.
Re:Lua in the Kernel? by brmgb on Friday September 18, 2020 @04:15AM (#24514226)
> In particular, limiting the number of Lua bytecode instructions is insufficient - even a single call to `string.find` can lock up the CPU [0].

At first glance, the second part of this sentence doesn't seem to support the initial premise. I am not too familiar with Lua bytecode but wouldn't "string.find" actually be compiled to multiple bytecode instructions ?

Unless a single bytecode instruction can lock up the cpu, doing so would most likely require either looping or recursive calls. Thus, by puting a hard limit on the number of instructions the sandbox can execute, it would end up aborting.

Re:Lua in the Kernel? by lmm on Friday September 18, 2020 @04:34AM (#24514366)
> I am not too familiar with Lua bytecode but wouldn't "string.find" actually be compiled to multiple bytecode instructions ?

It's probably a single opcode of "invoke native-code standard-library function/intrinsic".

Re:Lua in the Kernel? by pansa2 on Friday September 18, 2020 @04:53AM (#24514488)
Yes. `string.find` is implemented in C. Invoking it (no matter how complex its arguments) requires just a few bytecode instructions.
Re:Lua in the Kernel? by brmgb on Friday September 18, 2020 @06:53AM (#24515180)
Well, then that's library dependent and not an intrinsic part of the language. So shipping Lua safely would mean having to swap or drop parts of the standard library for something a bit more robust.

Apparently, that's what Lunatik does so the work seems to already have been done.

Re:Lua in the Kernel? by anonymoushn on Friday September 18, 2020 @08:12PM (#24523230)
Appending strings together is a single bytecode instruction and this cannot really be fixed.