News for hackers. Stuff that matters.
Re:A Lua interpreter in the NetBSD kernel by toyg on Sunday January 15, 2012 @01:22PM (#3467785)
Isn't this sort of approach a security nightmare ?
Re:A Lua interpreter in the NetBSD kernel by chalst on Sunday January 15, 2012 @04:42PM (#3468355)
Not if it's well-architected. Lua's sandboxes (using setf) allow pretty tight isolation of code.

http://lua-users.org/wiki/SandBoxes

There's a slide titled security in Marc Balmer's talk, but I didn't get where he was headed.

Re:A Lua interpreter in the NetBSD kernel by gregholmberg on Sunday January 15, 2012 @02:08PM (#3467920)
On a system without mandatory access controls [0], absolutely yes. This is what powers some rootkits. [1]

Having a dynamic interpreted language runtime available as just another item in the syscall table [2] would allow arbitrary, unrestricted execution of code that would not even respect resource limitations set in the root user's shell.

[0] http://en.wikipedia.org/wiki/Mandatory_access_control

[1] http://en.wikipedia.org/wiki/Rootkit#Kernel-mode

[2] http://fxr.watson.org/fxr/source/kern/syscalls.master

Re:A Lua interpreter in the NetBSD kernel by wisty on Sunday January 15, 2012 @09:05PM (#3469045)
I thought more modern languages could be more secure, as they tended to have better overflow protections and so on. So should kernels, but I guess this would be one way to ease features into the kernel (which might be seen as a bad thing).

The short answer will be, it depends on how it's done, and what the scope is. You wouldn't want arbitrary code loaded in.

Re:A Lua interpreter in the NetBSD kernel by joe_the_user on Sunday January 15, 2012 @06:46PM (#3468680)
More to the point, what value can be got from having an interpreter in the kernel?

Having the interpreter always available in user space seems more logical.

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.

[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

Re:A Lua interpreter in the NetBSD kernel by veyron on Sunday January 15, 2012 @08:09PM (#3468893)
I think the point is to replace the specialized languages used in frameworks like systemtap and dtruss/dtrace
Re:A Lua interpreter in the NetBSD kernel by nonUser on Sunday January 15, 2012 @01:53PM (#3467871)
Guess why it's not mainline ;)