On Fri, Mar 21, 2025 at 12:41 PM Rett Berg <
goog...@gmail.com> wrote:
>
> Cool stuff, another place where Lua can run!
>
> Is there a motivation for the project besides "achieve[ing] a fast time-to-market for delivering a smart firewall solution based on Netfilter scripting to a major Internet Service Provider (ISP)"?
Indeed; actually, I meant the motivation only for dropping the
framework approach and focusing on the Netfilter binding. The
motivation for scripting the kernel with Lua is the same as any other
application =). You can find some examples in the repository [1],
including an "extremely useful" konami code key-locker ;-).
> For example, could this be useful for the Linux kernel's test suite? Could it be used to intentionally add hooks for user programs to interact with the kernel unsafely on dev/test hardware for the purpose of debugging and real-time development?
Yes, you can even use kprobes for that. We have a luaprobe library.
For example, you can dynamically do something like this:
```
local probe = require("probe")
probe.new("my_symbol", {
pre = function () print("before") end,
post = function () print("after") end,
})
```
A more complete example on luaprobe usage is here [2], where we track syscalls.
We have also some GSoC project ideas for this year:
- Lunatik binding for Human Interface Devices (HID) drivers [3];
- Conntrack and NAT support for Lunatik [4];
- Lunatik Binding for Linux Traffic Control (TC) and eBPF Maps [5].
[1]
https://github.com/luainkernel/lunatik/tree/v3.6?tab=readme-ov-file#examples
[2]
https://github.com/luainkernel/lunatik/blob/v3.6/examples/systrack.lua
[3]
https://github.com/labluapucrio/gsoc?tab=readme-ov-file#lunatik-binding-for-human-interface-devices-hid-drivers
[4]
https://github.com/labluapucrio/gsoc?tab=readme-ov-file#conntrack-and-nat-support-for-lunatik
[5]
https://github.com/labluapucrio/gsoc?tab=readme-ov-file#lunatik-binding-for-linux-traffic-control-tc-and-ebpf-maps