Skip to content

Lunatik v5.2

Latest

Choose a tag to compare

@lneto lneto released this 22 Nov 22:29

Highlights

  • luaebpf, the Lua to eBPF compiler, has a repository of its own. Lunatik mounts it at luaebpf/ and this release carries luaebpf v0.1, whose documentation is at luainkernel.github.io/luaebpf. lunatik bpf compiles a program file into a BPF object and lunatik run --dev loads, attaches and pins it (#2030, #946, #2708, #2710).
  • Cryptography: crypto.sig verifies a signature with the kernel's ECDSA and RSA, so a script needs no userspace check (#1940); crypto.kpp agrees an ECDH secret in the kernel (#2360); crypto.comp serves every kernel over acomp (#2493); and shash and skcipher serve softirq runtimes, for keys a hook derives per packet (#2378).
  • Sets: one type, built from a list or a map, whose match answers the longest member (#1903); set.fromdata builds a set over the bytes of a data, and set.image reads a set image in Lua and builds the set over it (#1917).
  • Structs: a struct codec reads a struct's fields in place through a view, big-endian fields in host order and bitfields by name (#2641); bpf.map reads and writes a struct value by field name (#1984).
  • Packets: skb:hash() reads the flow hash the skb carries, so a script keys its state per flow (#1996); skb:ifname() names the device the packet holds (#2083); skb:checksum() finds the TCP or UDP header from the IP header wherever the hook sees the packet (#2334) and writes the sum the stack completes on a packet whose checksum is still pending (#2328); skb:data() reads a tc callback's non-linear skb (#2484); an XDP ctx reads the device and receive queue the packet arrived on (#1993); and netfilter.register takes a mask on the mark, so hooks can each own a field of it (#2056).
  • Time and randomness: linux.time([clock]) reads MONOTONIC and BOOTTIME, which a wall clock step does not move (#2062), and linux.random(m, n) draws uniformly from any interval (#2347, #2404).
  • sched_ext: an example schedules a workload through sched_ext (#2553); in an scx callback, print and warn write deferred (#2605), an allocation does not wake kswapd (#2631), a free does not hang its CPU (#2630), and the runqueue lock is marked per CPU (#2596).
  • 32-bit x86: lunatik.ko builds there, and Lua's % is right for a negative divisor (#2132, #2150).
  • Documentation: the site's pages fit a phone and its grey text meets WCAG AA contrast (#2712).

Fixes

  • A copy of an skb drops its route, its conntrack entry and its skb extensions, so a namespace's teardown neither waits on a script nor leaves anything freed for it to read (#2177, #2178, #2183); a copy reads its hook's device while the callback runs, and none once it returns (#2099).
  • skb:forward() refuses a copy whose device encrypts the original by MACsec offload, lets through one it sends out of a MACsec device, and sends a copy whose head is its own, so a later write misses the sent frame (#2183, #2189, #2350); data(), resize() and checksum() write into a head of the skb's own, not one a clone shares (#2355); in a tc callback checksum() refuses a non-linear skb (#2527).
  • set compares a key over its whole length, not its low 32 bits, and the empty set allocates nothing (#1932).
  • fifo takes its buffer from the runtime's allocator, so a fragmented system still serves it (#1922).
  • The core returns a vmalloc'd block freed in atomic context on a worker, which holds the core module until it runs (#1925, #2604); lunatik_closeobject raises with IRQs disabled (#1936); the monitor steps the collector after a method that grew the heap (#2335); a deferred release reads no freed memory (#2686); lunatik_run publishes its environment under RCU (#1976); a kfunc callback gets a copy of its ctx (#2114).
  • rcu initialises its table's SRCU at module load (#2634); lunatik.ko and zfs.ko load beside each other (#2662).
  • fsnotify reads the callback's verdict as the 64-bit value it is (#2294).
  • device.new refuses an empty name before the kernel WARNs on it, and uses the driver's name as given (#2304, #2288).
  • hid reads report_fixup's return type from struct hid_driver (#2120), and hid.register's and notifier's callbacks run on the body's task (#2498).
  • socket bind and connect pass the address type their own prototype takes, which 6.18.57 changed for bind (#2095); linux.socket takes the architecture's values where it has its own asm/socket.h (#2260).
  • crypto.kpp refuses a peer's point off the curve before any driver sees it, raises a driver's EINVAL, and raises EIO for an engine's status (#2463, #2504, #2500); a crypto class, and darken, raise EOPNOTSUPP where the kernel builds no API for them, so their modules still load (#2385, #2523); luacrypto is a module where CRYPTO_RNG2 is one, so crypto.rng links (#2516).
  • netfilter: a percpu runtime registers again a hook it stopped (#2340).
  • lunatik unload and list work on modules modprobe loaded, and modprobe lunatik_run loads luadevice first (#2647).
  • Examples: dnsdoctor recomputes the UDP checksum of a response it rewrote and walks the answers by their RDLENGTH (#2439, #2444); dnsblock and the other examples log a name with its control bytes as "?" (#2407, #2417); tcpreject's cleanup puts forwarding back to what its setup found (#2277, #2400); sniclassify's cleanup unpins on a deleted device (#2677).

Before upgrading

  • A checkout of Lunatik now mounts two repositories, harness/ and luaebpf/: after a clone or a pull, git submodule update --init fills them (#2706, #2708, #2710).
  • On a kernel built with CONFIG_PREEMPT_RT, a hardirq runtime is refused, since a spinlock sleeps there (#2616).

Changes to existing APIs

  • set.new takes a list of strings or a map from each member to a 32-bit label, and set:match answers the label of the longest member it ends in; set.labeled goes (#1903).
  • netfilter.register takes an optional mask beside the mark; without one it is the whole mark, as before (#2056).
  • linux.time takes an optional clock from linux.clock; without one it reads the real time, as before (#2062).

Known issues

  • On a kernel built with CONFIG_PREEMPT_RT, a percpu softirq set takes a sleeping lock with preemption off (#2610).
  • skb:checksum() writes a TCP or UDP check into an IPv4 fragment other than the first (#2321).
  • examples/tcpreject's cleanup leaves forwarding on after a setup that failed (#2676).

Contributors

Full Changelog: v5.1...v5.2