Re:A Lua interpreter in the NetBSD kernel
by gregholmberg on Sunday January 15, 2012 @09:19PM
(#3469075)
What value could Lua bring to a Unix kernel?
You could do some fast and very sophisticated manipulation of network traffic streams without requiring that each packet be copied to and from user-space. You wouldn't even have to develop much packet-twiddling code. There is a surprisingly large amount of network-specific open source Lua.
Wireshark, the most popular network protocol analyzer, has dissectors written in Lua. [0]
Nmap, the network mapper and port scanner, has a Lua-based scripting engine to allow session and endpoint property discovery in great detail. [1]
The popular intrusion detection tool Snort Security Platform (SnortSP) has included a Lua interpreter since version 3.0. [2]
Yes, keeping the interpreter in user-space is safer. I have a hard time imagining sandboxing within the language runtime being able to deal with some of the nastier traffic. Perhaps one prudent thing to do with an in-kernel interpreter would be to use a project-specific sanitizer that could reliably escape tokens and keywords found in live traffic.
You could do some fast and very sophisticated manipulation of network traffic streams without requiring that each packet be copied to and from user-space. You wouldn't even have to develop much packet-twiddling code. There is a surprisingly large amount of network-specific open source Lua.
Wireshark, the most popular network protocol analyzer, has dissectors written in Lua. [0]
Nmap, the network mapper and port scanner, has a Lua-based scripting engine to allow session and endpoint property discovery in great detail. [1]
The popular intrusion detection tool Snort Security Platform (SnortSP) has included a Lua interpreter since version 3.0. [2]
Yes, keeping the interpreter in user-space is safer. I have a hard time imagining sandboxing within the language runtime being able to deal with some of the nastier traffic. Perhaps one prudent thing to do with an in-kernel interpreter would be to use a project-specific sanitizer that could reliably escape tokens and keywords found in live traffic.
[0] "Lua Support in Wireshark" http://www.wireshark.org/docs/wsug_html_chunked/wsluarm.html
[1] "Nmap Scripting Engine" http://nmap.org/book/nse.html
[2] “A Pig(Snort), A Moon (Lua) and one very happy developer (Bill)” http://www.linuxsecurity.com/content/view/128135