Skip to content

LordOS — a free, fast and secure GNU/Linux distribution based on Debian, with its own desktop environment: display server and Wayland compositor in C, a React UI engine on QuickJS, and private native apps.

Pi kernel revision 3: SOCK_DESTROY, one release per revision, image and board checks

Federico Pereirad80189d2a1bf
diff --git a/docs/FIREWALL.md b/docs/FIREWALL.md
index 90be780..a23a960 100644
--- a/docs/FIREWALL.md
+++ b/docs/FIREWALL.md
@@ -772,10 +772,11 @@ per address at index 5) and the app's detail shows "Blocked traffic". The counte
second, so the row shows the block within a second.
**Kernels:** `SOCK_DESTROY` needs `CONFIG_INET_DIAG_DESTROY` (TCP) and `CONFIG_INET_UDP_DIAG` (UDP).
-Debian 13's kernel (6.12) has both. The Raspberry Pi kernel of the 0.8.2 image doesn't:
-`tools/rpi/build-kernel.sh` enables them from 0.8.3 on; with an older kernel the drop still
-applies and the journal says once that the app will see a stall (TCP retransmits until it gives
-up) instead of a reset. All 11 programs pass the verifier on 6.12 (VM 118) and on the Pi's
+Debian 13's kernel (6.12) has both. The Raspberry Pi kernel of the 0.8.2 and 0.8.3 images
+(`6.18.57-2+lordos`) doesn't; the LordOS Pi kernel has them since `6.18.57-3+lordos`
+(`6.18.57-lordos.3-rpi-2712`, 0.8.4; `RASPBERRY.md`, "The LordOS kernel"). With an older kernel the
+drop still applies and the journal says once that the app will see a stall (TCP retransmits until
+it gives up) instead of a reset. All 11 programs pass the verifier on 6.12 (VM 118) and on the Pi's
6.18.57 (`npverify-test`, built and run in a temporary folder, removed afterwards).
**Tests** (`tests/netperm_cut.sh`, VM 118, real network):
diff --git a/docs/RASPBERRY.md b/docs/RASPBERRY.md
index 7fe8c71..7e10b70 100644
--- a/docs/RASPBERRY.md
+++ b/docs/RASPBERRY.md
@@ -17,6 +17,13 @@ This document gathers what's needed to build the image, write it, develop on the
> LordOS kernel"), **switch files** on the boot partition (`ssh`, `remote-desktop`, Wi-Fi in
> `lordos-user.txt`; see "Switch files") and a post-flash check (`verify-board`, see "After
> flashing"). Built on the board; it is verified by booting the reflashed card.
+>
+> **Update (2026-10-19, 0.8.4):** `build-kernel.sh` now builds revision 3,
+> **`6.18.57-lordos.3-rpi-2712`** (`6.18.57-3+lordos`): the same source and options plus sock_diag
+> `SOCK_DESTROY` (`INET_DIAG_DESTROY`, `INET_UDP_DIAG`), so the firewall closes the connections a new
+> rule denies instead of leaving them stalled. Each kernel revision now has its own release, so the
+> previous one stays installed and bootable. **Not built yet:** the first attempt on the board (in a
+> tmpfs, see below) left the Pi unreachable; it needs a power cycle and enough free disk.
## Models
@@ -115,22 +122,25 @@ what LordOS needs:
```sh
# on the Pi (arm64 Debian 13): about 75 min per flavour on a Pi 5 (4 cores, SD card), ~10 GB free
+# on disk (not in a tmpfs: on the 16 GB board a 10 GB tmpfs for the build folder plus the final link
+# with full DWARF left it unreachable, 2026-10-19)
sudo apt-get install -y --no-install-recommends build-essential bc bison flex libssl-dev libelf-dev \
libdw-dev dwarves cpio kmod rsync dpkg-dev debhelper git
tools/rpi/build-kernel.sh /var/tmp/lordos-kernel all # 2712 (Pi 5), v8 (Pi 4), or all
-# → /var/tmp/lordos-kernel/out/linux-image-6.18.57-lordos-rpi-2712_6.18.57-2+lordos_arm64.deb, …
+# → /var/tmp/lordos-kernel/out/linux-image-6.18.57-lordos.3-rpi-2712_6.18.57-3+lordos_arm64.deb, …
```
- **Source:** `github.com/raspberrypi/linux`, branch `rpi-6.18.y` (`RPI_KERNEL_BRANCH`;
`RPI_KERNEL_REF=<commit>` pins one). The first build (2026-10-18) used commit `234188315037`,
kernel **6.18.57**; the archive shipped 6.18.50 at the time. The 0.8.1 rebuild (`-2+lordos`, BPF
- LSM and BTF) uses the same commit. `out/SOURCE` records it.
+ LSM and BTF) and the 0.8.4 one (`-3+lordos`, sock_diag `SOCK_DESTROY`) use the same commit.
+ `out/SOURCE` records it.
- **Config:** `bcm2712_defconfig` (Pi 5, 16K pages) or `bcm2711_defconfig` (Pi 4, 4K pages), then
`scripts/config` and `olddefconfig`. The whole diff against the defconfig (`out/config-*.diff`):
```diff
-CONFIG_LOCALVERSION="-v8-16k"
- +CONFIG_LOCALVERSION="-lordos-rpi-2712"
+ +CONFIG_LOCALVERSION="-lordos.3-rpi-2712"
-# CONFIG_SECURITY_LANDLOCK is not set
+CONFIG_SECURITY_LANDLOCK=y
-CONFIG_LSM=""
@@ -144,6 +154,10 @@ tools/rpi/build-kernel.sh /var/tmp/lordos-kernel all # 2712 (Pi 5), v8 (Pi 4
+CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y
+CONFIG_DEBUG_INFO_BTF=y
+CONFIG_DEBUG_INFO_BTF_MODULES=y
+ -# CONFIG_INET_UDP_DIAG is not set
+ +CONFIG_INET_UDP_DIAG=m
+ -# CONFIG_INET_DIAG_DESTROY is not set
+ +CONFIG_INET_DIAG_DESTROY=y
```
plus what `olddefconfig` derives from those (`PAHOLE_HAS_SPLIT_BTF`, `PROBE_EVENTS_BTF_ARGS`,
@@ -164,14 +178,34 @@ tools/rpi/build-kernel.sh /var/tmp/lordos-kernel all # 2712 (Pi 5), v8 (Pi 4
(`DEB_BUILD_PROFILES=pkg.linux-lordos-rpi-<flavour>.nokerneldbg`), so the package hardly grows.
The script checks `vmlinux` has a `.BTF` section. The build needs about 10 GB free while it runs
(the object files carry DWARF) and takes about 50 % longer.
+- **sock_diag `SOCK_DESTROY` (0.8.4, `-3+lordos`).** When a rule changes to deny, `lord-netperm`
+ drops the packets of the app's open connections and destroys its TCP and connected UDP (QUIC)
+ sockets over sock_diag netlink, so the app sees the connection end (`FIREWALL.md`, "Existing
+ connections are cut"). Destroying needs `CONFIG_INET_DIAG_DESTROY` (TCP) and `CONFIG_INET_UDP_DIAG`
+ (UDP); `INET_DIAG` and `INET_TCP_DIAG` are already modules in the defconfig (enforced too), and the
+ kernel loads them when `lord-netperm` opens its sock_diag socket. Raspberry Pi's defconfig leaves
+ the other two off. The options were in `build-kernel.sh` since 0.8.3, but the 0.8.3 image kept
+ 0.8.2's `-2+lordos` kernel, so on the Pi the connections stalled until the app's own timeout (the
+ journal says `the kernel can't destroy TCP sockets`). The script checks `INET_DIAG_DESTROY` stuck,
+ `build-img.sh` and `verify-board` check the kernel config.
- **Already in the defconfig, checked by the script** so a future defconfig can't drop them:
`SECCOMP_FILTER` (sandbox.c), cgroup v2 with `MEMCG`, `CGROUP_PIDS` and `CGROUP_SCHED` (per-app
limits; `cgroup_enable=memory` is in `cmdline.txt` because Raspberry Pi turns memcg off at boot),
and `BPF_SYSCALL`, `BPF_JIT`, `CGROUP_BPF` (lord-netperm's cgroup hooks). `USER_NS` stays as
Raspberry Pi has it, on (the launcher's own view for restricted Linux apps uses it).
-- **Packages:** `make bindeb-pkg`, version `6.18.57-2+lordos` (`LORDOS_KREV`; `-1` was 0.8.0's,
- without the BPF LSM), release `6.18.57-lordos-rpi-2712`
- (`-lordos-rpi-v8` for the Pi 4). The `-rpi-<flavour>` suffix is what `raspi-firmware`'s hook keys
+- **Packages:** `make bindeb-pkg`, version `6.18.57-3+lordos` (`LORDOS_KREV`; `-1` was 0.8.0's,
+ without the BPF LSM, `-2` 0.8.1's, without `SOCK_DESTROY`), release `6.18.57-lordos.3-rpi-2712`
+ (`-lordos.3-rpi-v8` for the Pi 4).
+ - **One release per revision (since `-3`).** Revisions 1 and 2 were both
+ `6.18.57-lordos-rpi-2712`, so a new revision replaced the old one's `vmlinuz` and
+ `/lib/modules` in place: the old kernel couldn't stay bootable, since with `MODVERSIONS` and
+ `DEBUG_INFO_BTF_MODULES` (without `MODULE_ALLOW_BTF_MISMATCH`) a kernel refuses another build's
+ modules, Wi-Fi among them. Now `-lordos.<rev>-rpi-<flavour>` is its own package
+ (`linux-image-6.18.57-lordos.3-rpi-2712`) next to the previous one, as Debian does with its ABI
+ numbers. The `.<rev>` form is chosen for the order: `sort -V` (the hook's "newest") puts
+ `-lordos.3-` after `-lordos-`, while `-lordos3-` or `-3-lordos-` would sort before it and the
+ hook would keep copying the old kernel.
+ - The `-rpi-<flavour>` suffix is what `raspi-firmware`'s hook keys
on, so it installs exactly like Raspberry Pi's: `kernel_2712.img`, initramfs, device trees and
overlays in `/boot/firmware`. The script checks the package carries the device trees and
overlays. Headers are built too (`linux-headers-*`), not put in the image.
@@ -452,7 +486,8 @@ sudo /usr/lib/lordos/rpi/verify-board --repo ~/LordOS # plus make -C server tes
| Check | PASS when |
|---|---|
-| kernel | `uname -r` is a `-lordos-rpi-*` kernel; page size 16K on the Pi 5 (4K with `-rpi-v8`) |
+| kernel | `uname -r` is a `-lordos-rpi-*` or `-lordos.<rev>-rpi-*` kernel; page size 16K on the Pi 5 (4K with `-rpi-v8`) |
+| socket destroy | the kernel config has `INET_DIAG_DESTROY`, `INET_TCP_DIAG` and `INET_UDP_DIAG` (the firewall closes the connections a new rule denies) |
| Landlock | `/sys/kernel/security/lsm` lists `landlock`; the kernel log says `landlock: Up and running`; the kernel config has `SECURITY_LANDLOCK`, `SECCOMP_FILTER`, `CGROUP_BPF`, `BPF_SYSCALL`, `MEMCG` |
| BPF LSM, BTF | `bpf` in `/sys/kernel/security/lsm`; `/sys/kernel/btf/vmlinux` present; the kernel config has `BPF_LSM` and `DEBUG_INFO_BTF`; `lord-netperm` active |
| seccomp, cgroups | seccomp available; the cgroup v2 `memory` controller is on (`cgroup_enable=memory`) |
diff --git a/docs/UPDATES.md b/docs/UPDATES.md
index 80fc4eb..b57adad 100644
--- a/docs/UPDATES.md
+++ b/docs/UPDATES.md
@@ -219,6 +219,13 @@ leave the board unbootable with no way back from the Store. It goes into the rep
image boots new kernels through the firmware's `tryboot` first and keeps the previous one as the
fallback. The `lordos` package itself updates on the Pi like anywhere else (arm64).
+Since `6.18.57-3+lordos` (0.8.4) each kernel revision is its own release and package
+(`linux-image-6.18.57-lordos.3-rpi-2712`), so a new one installs next to the previous one instead of
+over it, and the previous one stays bootable from its own folder on `bootfs` (`RASPBERRY.md`,
+"Switching kernels on a board"). That is the package side of the repository path; the automatic
+`tryboot` first boot is still missing, so the kernel stays out of the repository (staging and live)
+for now.
+
## Tests (2026-10-18)
- **Staging** (`https://lordos.org/apt-staging`, built and signed on the Mac with `apt-repo.sh`):
diff --git a/tools/rpi/build-img.sh b/tools/rpi/build-img.sh
index 207c11c..3650d42 100755
--- a/tools/rpi/build-img.sh
+++ b/tools/rpi/build-img.sh
@@ -81,7 +81,7 @@ PKGS_RPI_EXTRA="rpi-eeprom raspi-utils"
# per flavour; otherwise Raspberry Pi's.
OWN_KDEBS=""; ARCHIVE_K=""; OWN_FLAVOURS=""
for fl in 2712 v8; do
- d=$(ls "$KERNEL_DEBS"/linux-image-*-lordos-rpi-${fl}_*_arm64.deb 2>/dev/null | sort -V | tail -1 || true)
+ d=$(ls "$KERNEL_DEBS"/linux-image-*-lordos*-rpi-${fl}_*_arm64.deb 2>/dev/null | sort -V | tail -1 || true)
if [ -n "$d" ]; then OWN_KDEBS="$OWN_KDEBS $d"; OWN_FLAVOURS="$OWN_FLAVOURS $fl"
else ARCHIVE_K="$ARCHIVE_K linux-image-rpi-$fl"; fi
done
@@ -107,7 +107,7 @@ kernel_warning() {
echo "##########################################################################################" >&2
}
for fl in 2712 v8; do
- case " $OWN_FLAVOURS " in *" $fl "*) echo " kernel rpi-$fl: LordOS build ($(basename "$(ls "$KERNEL_DEBS"/linux-image-*-lordos-rpi-${fl}_*_arm64.deb | sort -V | tail -1)"))" ;;
+ case " $OWN_FLAVOURS " in *" $fl "*) echo " kernel rpi-$fl: LordOS build ($(basename "$(ls "$KERNEL_DEBS"/linux-image-*-lordos*-rpi-${fl}_*_arm64.deb | sort -V | tail -1)"))" ;;
*) kernel_warning "$fl" ;; esac
done
umount_tree() {
@@ -254,7 +254,7 @@ if [ -n "$OWN_KDEBS" ]; then
{
echo "# LordOS on Raspberry Pi: the kernel is LordOS's build of the Raspberry Pi kernel (Landlock, BPF LSM,"
echo "# tools/rpi/build-kernel.sh, docs/RASPBERRY.md). Raspberry Pi's kernel packages for the same"
- echo "# board are never installed over it; LordOS updates ship as new linux-image-*-lordos-rpi-* packages."
+ echo "# board are never installed over it; LordOS updates ship as new linux-image-*-lordos*-rpi-* packages."
for fl in $OWN_FLAVOURS; do
echo
echo "Package: linux-image-rpi-$fl linux-image-*+rpt-rpi-$fl linux-headers-rpi-$fl linux-headers-*+rpt-rpi-$fl"
@@ -331,6 +331,11 @@ for kv in $KV2712 $KV8; do
if grep -q '^CONFIG_BPF_LSM=y' "$CH/boot/config-$kv" 2>/dev/null && grep -q '^CONFIG_DEBUG_INFO_BTF=y' "$CH/boot/config-$kv"; then
echo " kernel $kv: BPF LSM and BTF built in"
else echo " WARNING: kernel $kv has no BPF LSM/BTF (\"No Bluetooth\" for Linux apps not enforced on that board)" >&2; fi
+ # sock_diag SOCK_DESTROY (6.18.57-3+lordos, 0.8.4): the firewall closes the connections a new rule denies
+ if grep -q '^CONFIG_INET_DIAG_DESTROY=y' "$CH/boot/config-$kv" 2>/dev/null &&
+ [ "$(grep -Ec '^CONFIG_INET_(TCP|UDP)_DIAG=[ym]' "$CH/boot/config-$kv")" = 2 ]; then
+ echo " kernel $kv: sock_diag SOCK_DESTROY built in"
+ else echo " WARNING: kernel $kv has no INET_DIAG_DESTROY/INET_UDP_DIAG (blocked connections stall instead of closing)" >&2; fi
done
# boot splash: the LordOS theme, and vc4 (HDMI) with DRM in the initramfs so Plymouth draws from the
# first seconds instead of waiting for the root file system. Plymouth's own hook adds the rest of
diff --git a/tools/rpi/build-kernel.sh b/tools/rpi/build-kernel.sh
index 8f79748..4dd9fd4 100644
--- a/tools/rpi/build-kernel.sh
+++ b/tools/rpi/build-kernel.sh
@@ -8,16 +8,20 @@
# tools/rpi/build-kernel.sh [work folder] [2712|v8|all] # default /var/tmp/lordos-kernel 2712
#
# Result: <work>/out/linux-image-<release>_<version>_arm64.deb (+ linux-headers-…), where
-# <release> = <upstream version>-lordos-rpi-2712 (Pi 5: bcm2712_defconfig, 16K pages)
-# <upstream version>-lordos-rpi-v8 (Pi 4/400/CM4: bcm2711_defconfig, 4K pages)
+# <release> = <upstream version>-lordos.<rev>-rpi-2712 (Pi 5: bcm2712_defconfig, 16K pages)
+# <upstream version>-lordos.<rev>-rpi-v8 (Pi 4/400/CM4: bcm2711_defconfig, 4K pages)
+# <rev> is LORDOS_KREV, so each revision is its own kernel release (own /lib/modules, own vmlinuz):
+# the previous one stays installed and bootable next to it, as with Debian's ABI bumps. Revisions 1
+# and 2 (0.8.0 to 0.8.3) were "-lordos-rpi-<flavour>"; "-lordos.<rev>" sorts after that in sort -V
+# (the hook's "newest"), "-lordos<rev>" or "-<rev>-lordos" would sort before it.
# The "-rpi-<flavour>" suffix is what raspi-firmware's kernel hook keys on (it copies the newest
# vmlinuz-*-rpi-2712 to kernel_2712.img and the device trees to /boot/firmware), so the package
# installs exactly like Raspberry Pi's own. tools/rpi/build-img.sh picks these .debs up from
# $KERNEL_DEBS (default /var/tmp/lordos-kernel/out).
#
# Variables: RPI_KERNEL_REPO (default the Raspberry Pi GitHub tree), RPI_KERNEL_BRANCH (rpi-6.18.y),
-# RPI_KERNEL_REF (a commit to pin; default the branch head), LORDOS_KREV (package revision, 2 since
-# 0.8.1: the BPF LSM and BTF were added to 6.18.57-1),
+# RPI_KERNEL_REF (a commit to pin; default the branch head), LORDOS_KREV (package revision: 3 since
+# 0.8.4, sock_diag SOCK_DESTROY; 2 was 0.8.1's, the BPF LSM and BTF; 1 was 0.8.0's),
# JOBS (default nproc). Building packages needs: build-essential bc bison flex libssl-dev
# libelf-dev libdw-dev dwarves (pahole, for BTF) cpio kmod rsync dpkg-dev debhelper git.
set -eu
@@ -27,7 +31,7 @@ FLAVOURS=${2:-2712}
REPO=${RPI_KERNEL_REPO:-https://github.com/raspberrypi/linux.git}
BRANCH=${RPI_KERNEL_BRANCH:-rpi-6.18.y}
REF=${RPI_KERNEL_REF:-}
-KREV=${LORDOS_KREV:-2}
+KREV=${LORDOS_KREV:-3}
JOBS=${JOBS:-$(nproc)}
SRC="$WORK/linux"
OUT="$WORK/out"
@@ -76,7 +80,7 @@ for FL in $FLAVOURS; do
*) echo "build-kernel.sh: unknown flavour $FL (2712, v8 or all)" >&2; exit 1 ;;
esac
B="$WORK/build-$FL"
- LV="-lordos-rpi-$FL"
+ LV="-lordos.$KREV-rpi-$FL"
echo "== $FL: $DEFCONFIG -> $KV$LV"
mkdir -p "$B"
# shellcheck disable=SC2086
diff --git a/tools/rpi/verify-board.sh b/tools/rpi/verify-board.sh
index b754028..da119e3 100644
--- a/tools/rpi/verify-board.sh
+++ b/tools/rpi/verify-board.sh
@@ -34,8 +34,8 @@ MODEL=$(tr -d '\0' < /proc/device-tree/model 2>/dev/null || echo unknown)
KREL=$(uname -r)
row INFO "board" "$MODEL"
case "$KREL" in
- *-lordos-rpi-*) row PASS "kernel (LordOS build)" "$KREL" ;;
- *) row FAIL "kernel (LordOS build)" "$KREL is not a -lordos-rpi-* kernel (Raspberry Pi's has no Landlock)" ;;
+ *-lordos-rpi-*|*-lordos.*-rpi-*) row PASS "kernel (LordOS build)" "$KREL" ;;
+ *) row FAIL "kernel (LordOS build)" "$KREL is not a -lordos[.<rev>]-rpi-* kernel (Raspberry Pi's has no Landlock)" ;;
esac
PS=$(getconf PAGESIZE 2>/dev/null || echo ?)
case "$KREL:$PS" in
@@ -70,6 +70,12 @@ if [ -f "$CFG" ]; then
done
if [ -z "$MISS" ]; then row PASS "kernel config" "LANDLOCK SECCOMP_FILTER CGROUP_BPF BPF_SYSCALL BPF_LSM DEBUG_INFO_BTF MEMCG"
else row FAIL "kernel config" "missing:$MISS"; fi
+ # sock_diag SOCK_DESTROY (0.8.4's kernel, 6.18.57-3+lordos): lord-netperm closes the open
+ # connections a new rule denies (docs/FIREWALL.md, "Existing connections are cut"); without it
+ # they are only dropped and the app stalls until its own timeout
+ if grep -q '^CONFIG_INET_DIAG_DESTROY=y' "$CFG" && [ "$(grep -Ec '^CONFIG_INET_(TCP|UDP)_DIAG=[ym]' "$CFG")" = 2 ]; then
+ row PASS "socket destroy" "INET_DIAG_DESTROY, INET_TCP_DIAG, INET_UDP_DIAG"
+ else row FAIL "socket destroy" "no INET_DIAG_DESTROY/INET_UDP_DIAG: blocked connections stall instead of closing"; fi
fi
grep -q '^Seccomp:' /proc/self/status && row PASS "seccomp" "available" || row FAIL "seccomp" "no Seccomp field in /proc/self/status"
CTRL=$(cat /sys/fs/cgroup/cgroup.controllers 2>/dev/null || echo "")