Skip to content

Lunatik v5.1

Latest

Choose a tag to compare

@lneto lneto released this 12 Oct 15:44

Lunatik v5.1

Lunatik 5.1 gives each linux.* table one kernel family, names the IP-level socket options, runs compiled chunks under darken, and serves the documentation of the latest release beside master's. It fixes the monitor every shared object's methods run through, netlink sends from interrupt context, a crypto rng that could not be created and autogen on 32-bit ARM, and make install no longer leaves behind what the tree dropped. Scripts written for 5.0 that read a renamed table need the changes listed under Changes to existing APIs.

Highlights

  • IP-level socket options: linux.socket.ip names the forty IP_* options the setsockopt and getsockopt of net/ipv4/ip_sockglue.c take, which a script spelled as literals (#1835).
  • Compiled chunks under darken: darken.run runs a chunk lunatic compiled, as require does, so a product can ship its scripts encrypted and compiled at once (#1767); darken.load and lighten.load decrypt and load a script without running it, and tools/shade.sh writes the dark script as a tail call of it, so an encrypted module nests no deeper on the kernel stack than a plain one (#1768).
  • Documentation: the site serves the latest release at its root, the newest of each earlier line from 5.0 under its version, 5.0/, and master under master/, each built from its own tag, and every page's switch lists them (#1781, #1881).

Fixes

  • Monitored methods, which every shared object's methods run through: a script's collectgarbage("stop") held only until its first monitored call, which restarted the collector (#1817); a resumed runtime that raised ready? reached the caller of resume as readyresume, every ? of the message renamed (#1867); a call or return hook set with debug.sethook ran the script's hook function under the object's lock, where one that slept scheduled while atomic, one that closed the object waited on the lock its own task held, and an error object one raised reached the monitor's rewrite of the message (#1879).
  • Netlink from interrupt context (#1742): a hardirq runtime's probe handler, or a softirq runtime's callback run with IRQs off, as a hid callback behind a USB host controller without HCD_BH is, could send on a netlink.channel and, with an nlmon tap up, re-enable bottom halves with IRQs off; netlink.channel.new refuses a hardirq runtime (#1818), and multicast and unicast refuse with IRQs disabled (#1863).
  • netfilter: register accepted an options table whose callback was missing or misspelled, and each packet the hook saw was accepted with "operation not defined" in the log; it now raises bad field 'hook' (function expected, got <type>) (#1823).
  • crypto: crypto.rng(name) and rng:reset() without a seed seed with seedsize() random bytes, so an algorithm whose seed size is not 0, ansi_cprng among them, can be created (#1822).
  • 32-bit ARM: autogen reads the constants 32-bit ARM prints after #, where every linux.* table came out empty and every struct layout had size 0 (#1821).
  • Installs: make install installs the modules the build made and the linux.* tables the specs generate, and removes what an earlier install left in the directories it owns, where a module or a file the tree renamed or dropped kept loading (#1838, #1845).
  • Build: every module declares a MODULE_DESCRIPTION, whose absence modpost warns about on every build from 6.15 (#1801).
  • Examples: dnsblock blocks example.net by default instead of GitHub and GitLab (#1809); ifquarantine serves each open a snapshot, so an event between two reads no longer tears a line (#1803); dnsdoctor keeps a symlinked /etc/resolv.conf a symlink (#1804).
  • Tests: the suite skips the packet socket's network order case on a big-endian host (#1795) and the netlink route and rule cases on a kernel without IPv4 policy routing (#1798), and the unix socket clients bound their receive, so a silent server fails its case instead of hanging the suite (#1800).

Before upgrading

  • Lunatik supports Linux 6.6 and later.
  • The linux.* names listed under Changes to existing APIs moved with no alias, and a script left on an old name reads nil, often silently: raw.new(eth.LLDP) on the old linux.eth binds every protocol, signal.kill given a name linux.signal no longer holds sends KILL, and linux.schedule given one linux.task no longer holds sleeps INTERRUPTIBLE (#1837).
  • make install removes kernel/lunatik in the module tree, and the linux, lunatik, socket, netlink, syscall, crypto, bpf and skb directories under /lib/modules/lua, before it writes them: a file of your own placed there is removed (#1838, #1845).
  • A chunk whose functions nest more than ten deep is out of contract for the kernel's stack (#1786).
  • 32-bit ARM: the OpenWrt build still fails on missing division helpers (#418).
  • On Linux 7.1 and later, luacrypto.ko loads only on a kernel that builds a user of the crypto rng API, such as CONFIG_CRYPTO_DRBG (#1415).
  • xdp and tc built without the running kernel's BTF (make btf_install before make) load with their kfunc unregistered and missing module BTF in the log, and an eBPF program that calls the kfunc then fails to load (#1607).

Changes to existing APIs

  • linux.* (#1826, #1829, #1831, #1833, #1834, #1837): one kernel family per table. linux.netlink.ALIGNTO is linux.netlink.align.ALIGNTO; linux.rtnetlink.iff is linux.iff; linux.pkttype is linux.packet.type; the ANY, NOEXIST and EXIST of linux.bpf are linux.bpf.update; linux.scx is linux.scx.dsq and linux.scx.slice; the ethertypes are linux.eth.proto, the netdevice events linux.netdev.cmd and the vt notifier events linux.vt.event; linux.signal holds the signals only and linux.task the task states only.
  • netlink (#1818, #1863): netlink.channel.new raises in a hardirq runtime, and multicast and unicast raise with IRQs disabled.
  • netfilter (#1823): register raises on an options table whose hook is not a function.
  • Debug hooks (#1879): a call or return hook sees a monitored method's wrapper call and return in place of the method's own, and one that also counts instructions restarts its countdown at each monitored call.

Known issues

Each is tracked in the issue it names, and the documentation of its module names the first four:

  • A sched_ext callback runs under its CPU's runqueue lock, where print, a completion's complete or a mailbox's send can hang the CPU (#1718).
  • A netdevice callback's STOP or BAD on an event the kernel does not veto stops the chain (#1739).
  • An rcu table a probe handler writes deadlocks against a writer that holds it with interrupts on (#1740).
  • A probe handler runs Lua in NMI, where its allocation can take a lock its CPU holds (#1741).
  • skb:data() and skb:resize() write into a head a clone shares (#1260).

Contributors

Lourival Vieira Neto (@lneto).

Full Changelog: v5.0...v5.1