News for hackers. Stuff that matters.
Re:Lua in the Kernel? by 0x76 on Friday September 18, 2020 @04:18AM (#24514245)
You can't prevent infinite loops unless you've solved the halting problem right?

They could of course just limit the run time if they really wanted to make sure scripts don't run indefinitely.

Re:Lua in the Kernel? by coldtea on Friday September 18, 2020 @05:32AM (#24514736)
>You can't prevent infinite loops unless you've solved the halting problem right?

Only in general arbitrary turing complete runtimes. For restricted subsets of instructions and specific implementations of runtimes you can. E.g. one could trivially disallow "jump" control flow, and limit loops to N iterations.

Re:Lua in the Kernel? by DarkWiiPlayer on Friday September 18, 2020 @07:00AM (#24515233)
It's more simple than that: pull the plug on the entire turing machine. Lua runs in a VM, so you can stop it from the outside, which wouldn't be possible if the code was running directly in the CPU (Without an OS underneath it, that is).
Re:Lua in the Kernel? by mikevin on Friday September 18, 2020 @03:44PM (#24521104)
You could argue this doesn't really count as preventing though. It's preventing a symptom instead of the underlying problem.
Re:Lua in the Kernel? by moring on Friday September 18, 2020 @04:42AM (#24514420)
The halting problem only says that you cannot tell if a program ever stops, i.e. takes a finite number of steps but without any a priori bounds. If you limit the number of steps to N, you can just run N steps of the program on your given input and look if it has stopped already.
Re:Lua in the Kernel? by tinus_hn on Friday September 18, 2020 @02:39PM (#24520380)
The problem only says you can’t tell if the programs stops without actually running it. But here you’re running it anyway.
Re:Lua in the Kernel? by gwd on Friday September 18, 2020 @04:33PM (#24521614)
If you run it and it stops, then it stops. If you run it and it runs forever, then it runs forever. But the point is that you want to know if it's going to run forever before you hit "forever".
Re:Lua in the Kernel? by pansa2 on Friday September 18, 2020 @05:05AM (#24514588)
> They could of course just limit the run time

It seems as though this would be more robust than limiting the number of bytecode instructions. I wonder if that’s true and if so, why it’s not more commonly recommended.

Re:Lua in the Kernel? by d33 on Friday September 18, 2020 @04:31AM (#24514338)
ePBF prevents infinite loops by restricting the language:

https://lwn.net/Articles/794934/