Single M0 kernel batch with CONFIG_SUSPEND off #17
@@ -113,6 +113,8 @@ jobs:
|
||||
qemu/rootfs/sbin/init qemu/rootfs/init tests/mk-bootimg/*.sh \
|
||||
tests/fetch-vendor/*.sh tests/fetch-buildroot-tarball/*.sh \
|
||||
tests/unpack-buildroot/*.sh
|
||||
- name: qemu init shellcheck regression test
|
||||
run: bash tests/qemu-init/run-init-shellcheck-tests.sh
|
||||
- name: cache apt archives (python3-pil)
|
||||
# Same cost class as the busybox binary cached below: a system package
|
||||
# plus its libjpeg/libpng transitive deps, downloaded fresh on every
|
||||
@@ -201,6 +203,65 @@ jobs:
|
||||
- name: build A/B disk image
|
||||
run: bash qemu/mkimage.sh
|
||||
|
||||
kernel-symbols:
|
||||
# The symbol gate (rebuild M0, kernel_symbols_exist): expand the real
|
||||
# configuration (pristine tarball + patch series + warden_defconfig) and
|
||||
# assert build/required-symbols.txt and probe-symbols.txt against the final
|
||||
# .config, without compiling. olddefconfig drops a symbol that does not exist
|
||||
# or whose dependencies are unmet without a word; this is what turns that
|
||||
# into a red check on every push, in seconds rather than the ~9 minutes of a
|
||||
# kernel build. The generic arm cross toolchain is enough: only the compiler
|
||||
# version text of the configuration depends on it.
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 15
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: offline symbol-list tests
|
||||
run: bash tests/required-symbols/run-required-symbols-tests.sh
|
||||
- name: install cross toolchain + kernel config deps
|
||||
run: |
|
||||
sudo apt-get update -qq
|
||||
sudo apt-get install -y -qq gcc-arm-linux-gnueabihf bc bison flex libssl-dev
|
||||
- name: provision `python` (SDK quirk, the build calls bare python)
|
||||
run: |
|
||||
mkdir -p "$RUNNER_TEMP/bin"
|
||||
ln -sf "$(command -v python3)" "$RUNNER_TEMP/bin/python"
|
||||
echo "$RUNNER_TEMP/bin" >> "$GITHUB_PATH"
|
||||
- name: cache pristine kernel tarball
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/linux-6.18.46.tar.xz
|
||||
key: linux-6.18.46-tarball
|
||||
- name: expand the configuration and assert the symbols
|
||||
env:
|
||||
# WORK must be OUTSIDE the repo checkout (git apply, issue #1).
|
||||
WORK: ${{ runner.temp }}/kcfg-work
|
||||
CONFIG_OUT: ${{ runner.temp }}/final.config
|
||||
CROSS_COMPILE: arm-linux-gnueabihf-
|
||||
WARDEN_CONFIG_ONLY: "1"
|
||||
run: |
|
||||
export KERNEL_TARBALL="$HOME/linux-6.18.46.tar.xz"
|
||||
bash build/build-kernel.sh
|
||||
test -s "$CONFIG_OUT" && test -s "$CONFIG_OUT.sha256"
|
||||
# the sidecar is the sha256 of the file it sits beside
|
||||
test "$(sha256sum "$CONFIG_OUT" | cut -d' ' -f1)" = "$(cat "$CONFIG_OUT.sha256")"
|
||||
- name: the expansion is deterministic (same inputs, same digest)
|
||||
env:
|
||||
WORK: ${{ runner.temp }}/kcfg-work-2
|
||||
CONFIG_OUT: ${{ runner.temp }}/final-2.config
|
||||
CROSS_COMPILE: arm-linux-gnueabihf-
|
||||
WARDEN_CONFIG_ONLY: "1"
|
||||
run: |
|
||||
export KERNEL_TARBALL="$HOME/linux-6.18.46.tar.xz"
|
||||
bash build/build-kernel.sh
|
||||
cmp "${{ runner.temp }}/final.config" "$CONFIG_OUT"
|
||||
- name: the digest does not depend on the host python (issue #19)
|
||||
env:
|
||||
CROSS_COMPILE: arm-linux-gnueabihf-
|
||||
run: |
|
||||
export KERNEL_TARBALL="$HOME/linux-6.18.46.tar.xz"
|
||||
bash tests/required-symbols/run-config-determinism-tests.sh
|
||||
|
||||
patches-apply:
|
||||
# The RV1106 series must apply cleanly onto pristine linux-6.18.46.
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
@@ -47,6 +47,13 @@ Add `WARDEN_KCONFIG_FRAGMENT=qemu/configs/virt.fragment` to step 1 for the
|
||||
kernel variant with the simulator's extra devices; `qemu/README.md` has the
|
||||
scenario tests (portal, OTA apply, display + touch, watchdog).
|
||||
|
||||
Every kernel symbol the platform needs is listed in `build/required-symbols.txt`
|
||||
(and `build/probe-symbols.txt` for a symbol under test). `build-kernel.sh` asserts
|
||||
both against the final `.config`, because `olddefconfig` drops an unknown or
|
||||
unsatisfied symbol without a word. `WARDEN_CONFIG_ONLY=1 CONFIG_OUT=<file>` stops
|
||||
after that assertion, so the gate takes seconds; `<file>.sha256` holds the digest
|
||||
of the final `.config` that firmware images record as `KCONFIG_SHA256`.
|
||||
|
||||
## Layout
|
||||
|
||||
| Directory | Contents |
|
||||
|
||||
+52
-15
@@ -19,6 +19,15 @@
|
||||
# (qemu/configs/virt.fragment builds the QEMU -M virt variant);
|
||||
# every fragment option is verified to have taken effect
|
||||
# WARDEN_CCACHE=1 compile through ccache (CI caches ~/.ccache)
|
||||
# WARDEN_CONFIG_ONLY=1
|
||||
# stop after the configuration and the symbol assertions
|
||||
# (no compile): a seconds-long symbol gate for CI and the
|
||||
# pre-build identity of /etc/warden-release. Needs CONFIG_OUT
|
||||
# or an explicit WORK, because a scratch WORK is removed.
|
||||
# CONFIG_OUT where the final .config is copied (default
|
||||
# $WORK/final.config); ${CONFIG_OUT}.sha256 gets its sha256
|
||||
# (hex only). Written by both modes: the config-only value
|
||||
# must equal the full build's, and the build checks it.
|
||||
# WARDEN_MODULES_COLLECT
|
||||
# space-separated in-tree dirs whose .ko files are wanted
|
||||
# (e.g. "drivers/net/wireless/aic8800"). Runs a full
|
||||
@@ -32,6 +41,10 @@ set -euo pipefail
|
||||
|
||||
KVER=6.18.46
|
||||
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # build/
|
||||
# shellcheck source=build/lib-required-symbols.sh
|
||||
. "$HERE/lib-required-symbols.sh"
|
||||
REQ_SYMBOLS="$HERE/required-symbols.txt"
|
||||
PROBE_SYMBOLS="$HERE/probe-symbols.txt"
|
||||
REPO="$(cd "$HERE/.." && pwd)"
|
||||
PATCHES="$REPO/patches"
|
||||
JOBS="${JOBS:-$(nproc)}"
|
||||
@@ -48,6 +61,16 @@ else
|
||||
WORK_OWNED=1
|
||||
fi
|
||||
trap '[ "${WORK_OWNED:-0}" = 1 ] && rm -rf "$WORK"' EXIT
|
||||
CONFIG_ONLY="${WARDEN_CONFIG_ONLY:-0}"
|
||||
case "$CONFIG_ONLY" in
|
||||
0|1) ;;
|
||||
*) echo "FATAL: WARDEN_CONFIG_ONLY must be 0 or 1, got '$CONFIG_ONLY'" >&2; exit 1 ;;
|
||||
esac
|
||||
if [ "$CONFIG_ONLY" = 1 ] && [ "$WORK_OWNED" = 1 ] && [ -z "${CONFIG_OUT:-}" ]; then
|
||||
echo "FATAL: WARDEN_CONFIG_ONLY=1 needs CONFIG_OUT (or an explicit WORK): a scratch WORK is removed on exit" >&2
|
||||
exit 1
|
||||
fi
|
||||
CONFIG_OUT="${CONFIG_OUT:-$WORK/final.config}"
|
||||
|
||||
log() { printf '\033[36m== %s\033[0m\n' "$*"; }
|
||||
|
||||
@@ -121,21 +144,17 @@ command -v "${CROSS_COMPILE}gcc" >/dev/null \
|
||||
|| { echo "cross toolchain ${CROSS_COMPILE}gcc not on PATH (set SDK_TC, or CROSS_COMPILE to one that is)" >&2; exit 1; }
|
||||
make -C "$SRC" ARCH=arm CROSS_COMPILE="$CROSS_COMPILE" olddefconfig >/dev/null
|
||||
|
||||
# Took-effect assertion for the symbols whose silent loss is a security hole,
|
||||
# not a build failure. olddefconfig drops a defconfig line whose dependencies
|
||||
# are unmet without a word, and the panel's firewall then quietly stops
|
||||
# covering IPv6 (flare-edge#533: no ip6tables filter table, so the IPv4
|
||||
# default-drop never applied to IPv6). Every symbol here must be built in
|
||||
# (=y): the panel has no /lib/modules.
|
||||
req_fail=0
|
||||
for sym in CONFIG_NF_DEFRAG_IPV6 CONFIG_IP6_NF_IPTABLES \
|
||||
CONFIG_IP6_NF_IPTABLES_LEGACY CONFIG_IP6_NF_FILTER; do
|
||||
grep -qxF "$sym=y" "$SRC/.config" || {
|
||||
echo "FATAL: required option $sym is not =y in the final .config (unmet Kconfig dependency?)" >&2
|
||||
req_fail=1
|
||||
}
|
||||
done
|
||||
[ "$req_fail" = 0 ] || exit 1
|
||||
# Took-effect assertion for every symbol the platform needs. olddefconfig drops
|
||||
# a defconfig line whose dependencies are unmet, or whose symbol does not exist,
|
||||
# without a word: flare-edge#533 shipped a firewall that quietly stopped
|
||||
# covering IPv6 that way. build/required-symbols.txt (and build/probe-symbols.txt
|
||||
# for a probe kernel) is the one list; every symbol in it is built in (=y, the
|
||||
# panel has no /lib/modules) or explicitly unset.
|
||||
# The probe list may be empty (every probe has passed); the required list may not.
|
||||
PROBE_LISTS=()
|
||||
[ -n "$(req_assertions "$PROBE_SYMBOLS")" ] && PROBE_LISTS=("$PROBE_SYMBOLS")
|
||||
req_assert_config "$SRC/.config" "$REQ_SYMBOLS" ${PROBE_LISTS[@]+"${PROBE_LISTS[@]}"} || exit 1
|
||||
log "required symbols verified in final .config ($(req_assertions "$REQ_SYMBOLS" | wc -l) required, $(req_assertions "$PROBE_SYMBOLS" | wc -l) probe)"
|
||||
|
||||
# Fragment took-effect assertion: merge_config -m only pastes text, and
|
||||
# olddefconfig silently resolves any symbol whose dependencies are unmet:
|
||||
@@ -167,6 +186,21 @@ if [ -n "${WARDEN_KCONFIG_FRAGMENT:-}" ]; then
|
||||
log "fragment options verified in final .config"
|
||||
fi
|
||||
|
||||
# The final .config, and its identity. KCONFIG_SHA256 in /etc/warden-release is
|
||||
# this digest (the whole file, compiler version text included): CONFIG_IKCONFIG_PROC
|
||||
# embeds a byte copy, so /proc/config.gz hashes to the same value.
|
||||
emit_config_identity() {
|
||||
mkdir -p "$(dirname "$CONFIG_OUT")"
|
||||
cp "$SRC/.config" "$CONFIG_OUT"
|
||||
sha256sum "$CONFIG_OUT" | awk '{print $1}' > "$CONFIG_OUT.sha256"
|
||||
echo "final.config sha256: $(cat "$CONFIG_OUT.sha256")"
|
||||
}
|
||||
if [ "$CONFIG_ONLY" = 1 ]; then
|
||||
emit_config_identity
|
||||
log "config-only: symbols verified, stopping before the compile"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Optional ccache (CI: cache ~/.ccache across dispatches; harmless if unset).
|
||||
KCC="${CROSS_COMPILE}gcc"
|
||||
if [ "${WARDEN_CCACHE:-0}" = 1 ]; then
|
||||
@@ -201,6 +235,9 @@ if [ -n "${WARDEN_MODULES_COLLECT:-}" ]; then
|
||||
ls -la "$MODOUT"
|
||||
fi
|
||||
|
||||
# Identity of the .config the compile actually used, not the one before it.
|
||||
emit_config_identity
|
||||
|
||||
Z="$SRC/arch/arm/boot/zImage"
|
||||
D="$SRC/arch/arm/boot/dts/rockchip/rv1106-warden.dtb"
|
||||
log "build OK"
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
# shellcheck shell=bash
|
||||
# Shared by build-kernel.sh and the symbol tests (tests/required-symbols/).
|
||||
#
|
||||
# build/required-symbols.txt is the source of record for every kernel symbol
|
||||
# the platform needs (rebuild M0, names.md 21.1). Format, one item per line:
|
||||
#
|
||||
# CONFIG_X=y assert the symbol is =y in the final .config
|
||||
# # CONFIG_X is not set assert the symbol is NOT set (an explicit unset)
|
||||
# ## tier R section header (R required, C recommended,
|
||||
# A assertion only / derived, never in a defconfig)
|
||||
# # any other text comment
|
||||
# (blank lines ignored)
|
||||
#
|
||||
# build/probe-symbols.txt has the same format for tier P: symbols built into
|
||||
# the test kernel to run a probe. They are asserted like the others, and join
|
||||
# required-symbols.txt only when the probe passes.
|
||||
|
||||
# req_assertions FILE: print the assertion lines of FILE.
|
||||
req_assertions() {
|
||||
grep -E '^(CONFIG_[A-Za-z0-9_]+=[ymn]|# CONFIG_[A-Za-z0-9_]+ is not set)$' "$1" || true
|
||||
}
|
||||
|
||||
# req_assert_config CONFIG LIST...: check each assertion of each LIST against
|
||||
# CONFIG (a final .config). Prints one FATAL line per failure and returns 1 if
|
||||
# any failed. A missing or empty LIST is itself a failure (fail closed).
|
||||
req_assert_config() {
|
||||
local cfg="$1" list line opt n bad=0
|
||||
shift
|
||||
[ -s "$cfg" ] || { echo "FATAL: config '$cfg' is missing or empty" >&2; return 1; }
|
||||
for list in "$@"; do
|
||||
[ -f "$list" ] || { echo "FATAL: symbol list '$list' is missing" >&2; return 1; }
|
||||
n=0
|
||||
while IFS= read -r line; do
|
||||
n=$((n + 1))
|
||||
case "$line" in
|
||||
CONFIG_*=*)
|
||||
grep -qxF "$line" "$cfg" || {
|
||||
echo "FATAL: required option $line is not in the final .config (unmet Kconfig dependency, or the symbol does not exist?)" >&2
|
||||
bad=1
|
||||
} ;;
|
||||
"# CONFIG_"*" is not set")
|
||||
# An unset holds if the symbol is absent or shown as "is not set";
|
||||
# only a live =value fails (a dependency may hide the symbol).
|
||||
opt="${line#\# }"; opt="${opt% is not set}"
|
||||
grep -qE "^$opt=" "$cfg" && {
|
||||
echo "FATAL: option $opt must not be set but is in the final .config" >&2
|
||||
bad=1
|
||||
} ;;
|
||||
esac
|
||||
done < <(req_assertions "$list")
|
||||
[ "$n" -gt 0 ] || { echo "FATAL: symbol list '$list' holds no assertions" >&2; return 1; }
|
||||
done
|
||||
return "$bad"
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
## Tier P: symbols built into a test kernel to run a probe (rebuild M0).
|
||||
## Asserted like required-symbols.txt. A symbol moves to required-symbols.txt when its probe
|
||||
## passes on the panel, and leaves this file and the defconfig when it fails.
|
||||
##
|
||||
## Empty on purpose: probe V3 (hardware RNG, N-36, d06 O14, d09 T14) passed on 2026-10-09, so
|
||||
## CONFIG_HW_RANDOM and CONFIG_HW_RANDOM_ROCKCHIP moved to required-symbols.txt. An empty list
|
||||
## is valid for this file (build-kernel.sh skips it); required-symbols.txt may never be empty.
|
||||
@@ -0,0 +1,83 @@
|
||||
## Kernel symbols the platform needs. Source of record (rebuild M0, names.md
|
||||
## 21.1): build-kernel.sh asserts every line against the final .config, the
|
||||
## tests/required-symbols guards read this file, and the FE kernel_symbols_exist
|
||||
## gate checks every CONFIG_ name in the specs against it and the Kconfig tree.
|
||||
## Format: see build/lib-required-symbols.sh. Tier P lives in probe-symbols.txt.
|
||||
##
|
||||
## tier R already shipped (flare-edge#533)
|
||||
CONFIG_NF_DEFRAG_IPV6=y
|
||||
CONFIG_IP6_NF_IPTABLES=y
|
||||
CONFIG_IP6_NF_IPTABLES_LEGACY=y
|
||||
CONFIG_IP6_NF_FILTER=y
|
||||
##
|
||||
## tier R cgroup v2 controllers (W-D7)
|
||||
CONFIG_MEMCG=y
|
||||
CONFIG_CGROUP_PIDS=y
|
||||
CONFIG_CGROUP_SCHED=y
|
||||
CONFIG_FAIR_GROUP_SCHED=y
|
||||
CONFIG_CFS_BANDWIDTH=y
|
||||
##
|
||||
## tier R byte metering (D50 D51 D52)
|
||||
CONFIG_NETFILTER_XT_MATCH_CGROUP=y
|
||||
CONFIG_NETFILTER_XT_CONNMARK=y
|
||||
CONFIG_NETFILTER_XT_MARK=y
|
||||
CONFIG_IP6_NF_MANGLE=y
|
||||
##
|
||||
## tier R /proc/config.gz (D51)
|
||||
CONFIG_IKCONFIG=y
|
||||
CONFIG_IKCONFIG_PROC=y
|
||||
##
|
||||
## tier R uid fallback and NOTRACK (SCH-04, flare-edge#537)
|
||||
CONFIG_NETFILTER_XT_MATCH_OWNER=y
|
||||
CONFIG_IP_NF_RAW=y
|
||||
CONFIG_IP6_NF_RAW=y
|
||||
CONFIG_NETFILTER_XT_TARGET_CT=y
|
||||
##
|
||||
## tier R namespaces and PSI (SCH-04, NN-11)
|
||||
CONFIG_NAMESPACES=y
|
||||
CONFIG_UTS_NS=y
|
||||
CONFIG_IPC_NS=y
|
||||
CONFIG_PID_NS=y
|
||||
CONFIG_NET_NS=y
|
||||
CONFIG_USER_NS=y
|
||||
CONFIG_PSI=y
|
||||
##
|
||||
## tier R nftables (N-40)
|
||||
CONFIG_NF_TABLES=y
|
||||
CONFIG_NF_TABLES_IPV4=y
|
||||
CONFIG_NF_TABLES_IPV6=y
|
||||
CONFIG_NFT_CT=y
|
||||
CONFIG_NFT_MASQ=y
|
||||
CONFIG_NFT_NAT=y
|
||||
CONFIG_NFT_LIMIT=y
|
||||
CONFIG_NFT_SOCKET=y
|
||||
CONFIG_NFT_REJECT=y
|
||||
##
|
||||
## tier R hardware RNG (N-36, d06 O14). Probe V3 passed on the bench panel on 2026-10-09
|
||||
## (/dev/hwrng from rockchip-rng, 2.6 MB read in 2.4 s, 1 FIPS 140-2 failure in 1000 blocks), so
|
||||
## the two symbols moved here from probe-symbols.txt.
|
||||
CONFIG_HW_RANDOM=y
|
||||
CONFIG_HW_RANDOM_ROCKCHIP=y
|
||||
##
|
||||
## tier A power: no suspend (Noah 2026-10-09). The two lines below are derived
|
||||
## off with it; assert them so a Kconfig change cannot bring them back.
|
||||
# CONFIG_SUSPEND is not set
|
||||
# CONFIG_PM_SLEEP is not set
|
||||
##
|
||||
## tier C recommended
|
||||
CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=y
|
||||
CONFIG_NF_CONNTRACK_PROCFS=y
|
||||
##
|
||||
## tier A assertion only (a defconfig line is optional)
|
||||
CONFIG_SECCOMP=y
|
||||
CONFIG_SECCOMP_FILTER=y
|
||||
CONFIG_MULTIUSER=y
|
||||
CONFIG_SYSVIPC=y
|
||||
# CONFIG_RT_GROUP_SCHED is not set
|
||||
# CONFIG_TIME_NS is not set
|
||||
##
|
||||
## tier A derived (selected or defaulted by other symbols; never in a defconfig)
|
||||
CONFIG_NF_CONNTRACK_MARK=y
|
||||
CONFIG_SOCK_CGROUP_DATA=y
|
||||
CONFIG_NFT_REJECT_IPV4=y
|
||||
CONFIG_NFT_REJECT_IPV6=y
|
||||
@@ -1395,3 +1395,101 @@ CONFIG_NF_DEFRAG_IPV6=y
|
||||
CONFIG_IP6_NF_IPTABLES=y
|
||||
CONFIG_IP6_NF_IPTABLES_LEGACY=y
|
||||
CONFIG_IP6_NF_FILTER=y
|
||||
#
|
||||
# Cgroup v2 controllers, byte metering, raw table, namespaces and PSI
|
||||
# (rebuild M0; D50 D51 D52 W-D7 SCH-04 N-40 NN-11). The single kernel flash:
|
||||
# every option later work needs, so no second t2 update reaches a panel.
|
||||
# build/required-symbols.txt is the source of record and build-kernel.sh
|
||||
# asserts every line of it against the final .config. All built in: the panel
|
||||
# has no /lib/modules.
|
||||
#
|
||||
# Per-app limits (W-D7): memory.max / memory.events / memory.oom.group,
|
||||
# pids.max, cpu.weight and the cpu.max hard cap.
|
||||
CONFIG_MEMCG=y
|
||||
CONFIG_CGROUP_PIDS=y
|
||||
CONFIG_CGROUP_SCHED=y
|
||||
CONFIG_FAIR_GROUP_SCHED=y
|
||||
CONFIG_CFS_BANDWIDTH=y
|
||||
# RT group scheduling would block the v2 cpu controller; it must stay off.
|
||||
# CONFIG_RT_GROUP_SCHED is not set
|
||||
#
|
||||
# Byte metering by cgroup (D50 D51 D52): the cgroup match, CONNMARK so inbound
|
||||
# replies inherit the service, the mark match, and the ip6tables mangle table
|
||||
# (it defaults to =m under legacy). The meter itself is nftables since N-40.
|
||||
CONFIG_NETFILTER_XT_MATCH_CGROUP=y
|
||||
CONFIG_NETFILTER_XT_CONNMARK=y
|
||||
CONFIG_NETFILTER_XT_MARK=y
|
||||
CONFIG_IP6_NF_MANGLE=y
|
||||
#
|
||||
# /proc/config.gz (D51). IKCONFIG is a tristate: it must be =y, no module tree.
|
||||
# The whole .config digest (KCONFIG_SHA256 in /etc/warden-release) equals the
|
||||
# sha256 of the decompressed embed.
|
||||
CONFIG_IKCONFIG=y
|
||||
CONFIG_IKCONFIG_PROC=y
|
||||
#
|
||||
# Uid fallback metering (SCH-04), and the raw table with the CT target for the
|
||||
# NOTRACK of the discovery sweep (flare-edge#537). The legacy tables stay for
|
||||
# that interim and for any legacy tool in the image.
|
||||
CONFIG_NETFILTER_XT_MATCH_OWNER=y
|
||||
CONFIG_IP_NF_RAW=y
|
||||
CONFIG_IP6_NF_RAW=y
|
||||
CONFIG_NETFILTER_XT_TARGET_CT=y
|
||||
#
|
||||
# Cheap rule helpers. CONNTRACK_PROCFS keeps /proc/net/nf_conntrack so the
|
||||
# cause of #537 and its fix can be proven (C14).
|
||||
CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=y
|
||||
CONFIG_NF_CONNTRACK_PROCFS=y
|
||||
#
|
||||
# Namespaces for future app sandboxing (SCH-04, NN-11): NAMESPACES is a prompt
|
||||
# only under EXPERT and defaults off there, so it needs this line. All five
|
||||
# sub-options are set; USER_NS stays closed at runtime by
|
||||
# user.max_user_namespaces=0 (S02warden-sysctl) until the app sandbox needs it.
|
||||
# TIME_NS defaults on, so it is unset explicitly.
|
||||
CONFIG_NAMESPACES=y
|
||||
CONFIG_UTS_NS=y
|
||||
CONFIG_IPC_NS=y
|
||||
CONFIG_PID_NS=y
|
||||
CONFIG_NET_NS=y
|
||||
CONFIG_USER_NS=y
|
||||
# CONFIG_TIME_NS is not set
|
||||
#
|
||||
# Pressure stall information (SCH-04): /proc/pressure/* and per-cgroup
|
||||
# cpu.pressure and memory.pressure. On at boot (PSI_DEFAULT_DISABLED stays off).
|
||||
CONFIG_PSI=y
|
||||
#
|
||||
# nftables (N-40): the applier and the meter target nft in the families ip and
|
||||
# ip6. Counters, meta, payload, sets and jump are nf_tables core; there is no
|
||||
# NFT_COUNTER symbol. NFT_REJECT_IPV4 and NFT_REJECT_IPV6 have no prompt and
|
||||
# derive from NFT_REJECT, so they are asserted in required-symbols.txt and
|
||||
# never set here (a line for a promptless symbol is dropped).
|
||||
CONFIG_NF_TABLES=y
|
||||
CONFIG_NF_TABLES_IPV4=y
|
||||
CONFIG_NF_TABLES_IPV6=y
|
||||
CONFIG_NFT_CT=y
|
||||
CONFIG_NFT_MASQ=y
|
||||
CONFIG_NFT_NAT=y
|
||||
CONFIG_NFT_LIMIT=y
|
||||
CONFIG_NFT_SOCKET=y
|
||||
CONFIG_NFT_REJECT=y
|
||||
#
|
||||
# No suspend (rebuild M0, Noah 2026-10-09): the panel is wall powered and never
|
||||
# sleeps the SoC, and nothing in the product wakes it. Turning SUSPEND off lets
|
||||
# Kconfig drop everything that existed only for it: PM_SLEEP and PM_SLEEP_SMP,
|
||||
# SUSPEND_FREEZER and FREEZER, PM_GENERIC_DOMAINS_SLEEP, FW_CACHE (firmware
|
||||
# cached across a suspend) and VT_CONSOLE_SLEEP. PM_SLEEP_SMP was also the only
|
||||
# thing selecting HOTPLUG_CPU on this one-core SoC, and an SMP ARM kernel offers
|
||||
# KEXEC and CRASH_DUMP only with it, so those go too (nothing uses them: the
|
||||
# kexec flash path was a 5.10 experiment). PM, PM_CLK, runtime PM and
|
||||
# ARM_CPU_SUSPEND (kept by ARM_PSCI_FW) stay, because the USB, DRM and Wi-Fi
|
||||
# drivers use runtime PM. Hibernation was already off. The AIC8800 driver must
|
||||
# keep building and loading; the SDK build and the slot test prove it.
|
||||
# CONFIG_SUSPEND is not set
|
||||
# PM_SLEEP has no prompt and follows SUSPEND; the line records the expected result, and
|
||||
# required-symbols.txt asserts it against the final .config.
|
||||
# CONFIG_PM_SLEEP is not set
|
||||
#
|
||||
# Probe tier (N-36, d06 O14, probe V3): the Rockchip hardware RNG, built into
|
||||
# the test kernel. build/probe-symbols.txt lists it; it moves to
|
||||
# required-symbols.txt only if V3 passes on the panel, and comes out of this
|
||||
# file if it fails.
|
||||
CONFIG_HW_RANDOM_ROCKCHIP=y
|
||||
|
||||
@@ -337,12 +337,21 @@ static struct rockchip_clk_branch rv1106_clk_branches[] __initdata = {
|
||||
/* PD_CORE */
|
||||
GATE(CLK_PVTM_CORE, "clk_pvtm_core", "xin24m", 0,
|
||||
RV1106_CORECLKGATE_CON(0), 14, GFLAGS),
|
||||
GATE(CLK_CORE_MCU_RTC, "clk_core_mcu_rtc", "xin24m", 0,
|
||||
/* clk_core_mcu_rtc is the 24 MHz mtime of the HPMCU, kept up for the
|
||||
* mtime safety tick. Nothing in Linux claims it, so clk_disable_unused()
|
||||
* would gate it after boot; IGNORE_UNUSED keeps it running, like
|
||||
* clk_core_mcu below (rebuild M0, SCH-01). */
|
||||
GATE(CLK_CORE_MCU_RTC, "clk_core_mcu_rtc", "xin24m", CLK_IGNORE_UNUSED,
|
||||
RV1106_CORECLKGATE_CON(1), 6, GFLAGS),
|
||||
COMPOSITE(HCLK_CPU, "hclk_cpu", mux_gpll_24m_p, CLK_IS_CRITICAL,
|
||||
RV1106_CORECLKSEL_CON(2), 5, 1, MFLAGS, 0, 5, DFLAGS,
|
||||
RV1106_CORECLKGATE_CON(0), 12, GFLAGS),
|
||||
COMPOSITE(CLK_CORE_MCU, "clk_core_mcu", mux_gpll_24m_p, 0,
|
||||
/* The HPMCU (RISC-V SCR1 coprocessor) runs on clk_core_mcu, but nothing in
|
||||
* Linux claims it, so clk_disable_unused() switches it off at boot and any
|
||||
* firmware loaded into the coprocessor never executes. Mark it
|
||||
* IGNORE_UNUSED so the coprocessor clock stays up (5.10 left it running;
|
||||
* our 6.18 disabled it). A future remoteproc/coproc driver could claim it. */
|
||||
COMPOSITE(CLK_CORE_MCU, "clk_core_mcu", mux_gpll_24m_p, CLK_IGNORE_UNUSED,
|
||||
RV1106_CORECLKSEL_CON(3), 11, 1, MFLAGS, 6, 5, DFLAGS,
|
||||
RV1106_CORECLKGATE_CON(1), 1, GFLAGS),
|
||||
COMPOSITE_NOMUX(0, "pclk_dbg", "armclk", CLK_IS_CRITICAL,
|
||||
|
||||
+98
@@ -0,0 +1,98 @@
|
||||
From: BlueFlare Warden <noah@wildrosemining.com>
|
||||
Subject: [PATCH] datatype: take the cgroupv2 id from the directory's file handle
|
||||
|
||||
"socket cgroupv2 level N <path>" compares the 64-bit kernfs id of the cgroup.
|
||||
nft built it from st_ino, which equals the id only on 64-bit kernels. On a
|
||||
32-bit kernel (armv7) the id is (generation << 32) | ino and st_ino carries the
|
||||
low half, so every rule built from a path compared against the wrong value and
|
||||
never matched: nothing was counted per service.
|
||||
|
||||
The directory's file handle holds the whole id on both. It is read with the raw
|
||||
name_to_handle_at syscall because uClibc has no wrapper. The listing path (id
|
||||
back to a name) uses the same helper.
|
||||
|
||||
Found on the WardenOS panel kernel (6.18.46, armv7) with nftables 1.1.0.
|
||||
|
||||
diff --git a/src/datatype.c b/src/datatype.c
|
||||
index d398a9c..289f930 100644
|
||||
--- a/src/datatype.c
|
||||
+++ b/src/datatype.c
|
||||
@@ -19,7 +19,10 @@
|
||||
#include <linux/netfilter.h>
|
||||
#include <linux/icmpv6.h>
|
||||
#include <dirent.h>
|
||||
+#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
+#include <sys/syscall.h>
|
||||
+#include <unistd.h>
|
||||
|
||||
#include <nftables.h>
|
||||
#include <datatype.h>
|
||||
@@ -1605,12 +1608,47 @@ const struct datatype policy_type = {
|
||||
|
||||
#define SYSFS_CGROUPSV2_PATH "/sys/fs/cgroup"
|
||||
|
||||
+/* The id the kernel compares in "socket cgroupv2" is the 64-bit kernfs id of
|
||||
+ * the cgroup directory. On 64-bit kernels that is st_ino, but on 32-bit kernels
|
||||
+ * it is (generation << 32) | ino and st_ino carries only the low half, so a
|
||||
+ * rule built from st_ino never matches. The file handle of the directory holds
|
||||
+ * the full id on both. The handle is read with the raw syscall: uClibc has no
|
||||
+ * name_to_handle_at() or struct file_handle. Fall back to st_ino where the
|
||||
+ * syscall is missing. */
|
||||
+static bool cgroupv2_path_id(const char *path, uint64_t *id)
|
||||
+{
|
||||
+#ifdef __NR_name_to_handle_at
|
||||
+ struct {
|
||||
+ unsigned int handle_bytes;
|
||||
+ int handle_type;
|
||||
+ unsigned char f_handle[sizeof(uint64_t)];
|
||||
+ } h;
|
||||
+ int mount_id;
|
||||
+
|
||||
+ h.handle_bytes = sizeof(h.f_handle);
|
||||
+ if (syscall(__NR_name_to_handle_at, AT_FDCWD, path, &h, &mount_id, 0) == 0 &&
|
||||
+ h.handle_bytes == sizeof(*id)) {
|
||||
+ memcpy(id, h.f_handle, sizeof(*id));
|
||||
+ return true;
|
||||
+ }
|
||||
+#endif
|
||||
+ {
|
||||
+ struct stat st;
|
||||
+
|
||||
+ if (stat(path, &st) < 0)
|
||||
+ return false;
|
||||
+ *id = st.st_ino;
|
||||
+ return true;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
static char *cgroupv2_get_path(const char *path, uint64_t id)
|
||||
{
|
||||
char dent_name[PATH_MAX + 1];
|
||||
char *cgroup_path = NULL;
|
||||
struct dirent *dent;
|
||||
struct stat st;
|
||||
+ uint64_t dent_id;
|
||||
DIR *d;
|
||||
|
||||
d = opendir(path);
|
||||
@@ -1626,7 +1664,7 @@ static char *cgroupv2_get_path(const char *path, uint64_t id)
|
||||
path, dent->d_name);
|
||||
dent_name[sizeof(dent_name) - 1] = '\0';
|
||||
|
||||
- if (dent->d_ino == id) {
|
||||
+ if (cgroupv2_path_id(dent_name, &dent_id) && dent_id == id) {
|
||||
cgroup_path = xstrdup(dent_name);
|
||||
break;
|
||||
}
|
||||
@@ -1674,7 +1712,9 @@ static struct error_record *cgroupv2_type_parse(struct parse_ctx *ctx,
|
||||
return error(&sym->location, "cgroupv2 path fails: %s",
|
||||
strerror(errno));
|
||||
|
||||
- ino = st.st_ino;
|
||||
+ if (!cgroupv2_path_id(cgroupv2_path, &ino))
|
||||
+ return error(&sym->location, "cgroupv2 path fails: %s",
|
||||
+ strerror(errno));
|
||||
*res = constant_expr_alloc(&sym->location, &cgroupv2_type,
|
||||
BYTEORDER_HOST_ENDIAN,
|
||||
sizeof(ino) * BITS_PER_BYTE, &ino);
|
||||
@@ -33,7 +33,7 @@ new file mode 100644
|
||||
index 000000000..b44eeeadd
|
||||
--- /dev/null
|
||||
+++ b/drivers/clk/rockchip/clk-rv1106.c
|
||||
@@ -0,0 +1,1299 @@
|
||||
@@ -0,0 +1,1303 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0
|
||||
+/*
|
||||
+ * Copyright (c) 2022 Rockchip Electronics Co. Ltd.
|
||||
@@ -373,7 +373,11 @@ index 000000000..b44eeeadd
|
||||
+ /* PD_CORE */
|
||||
+ GATE(CLK_PVTM_CORE, "clk_pvtm_core", "xin24m", 0,
|
||||
+ RV1106_CORECLKGATE_CON(0), 14, GFLAGS),
|
||||
+ GATE(CLK_CORE_MCU_RTC, "clk_core_mcu_rtc", "xin24m", 0,
|
||||
+ /* clk_core_mcu_rtc is the 24 MHz mtime of the HPMCU, kept up for the
|
||||
+ * mtime safety tick. Nothing in Linux claims it, so clk_disable_unused()
|
||||
+ * would gate it after boot; IGNORE_UNUSED keeps it running, like
|
||||
+ * clk_core_mcu below (rebuild M0, SCH-01). */
|
||||
+ GATE(CLK_CORE_MCU_RTC, "clk_core_mcu_rtc", "xin24m", CLK_IGNORE_UNUSED,
|
||||
+ RV1106_CORECLKGATE_CON(1), 6, GFLAGS),
|
||||
+ COMPOSITE(HCLK_CPU, "hclk_cpu", mux_gpll_24m_p, CLK_IS_CRITICAL,
|
||||
+ RV1106_CORECLKSEL_CON(2), 5, 1, MFLAGS, 0, 5, DFLAGS,
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
Remove the DRM_MSM_VALIDATE_XML Kconfig symbol (rebuild M0, bfe-core1106-sdk#19).
|
||||
|
||||
Its dependency $(success,$(PYTHON3) -c "import lxml") makes the expanded .config differ by host: with
|
||||
python3-lxml importable the file gains '# CONFIG_DRM_MSM_VALIDATE_XML is not set', without it the line is
|
||||
absent, so KCONFIG_SHA256 was not reproducible across hosts. The symbol only validates Qualcomm GPU register
|
||||
XML for DRM MSM developers; the panel has no Qualcomm GPU. No binary changes.
|
||||
|
||||
diff --git a/drivers/gpu/drm/msm/Kconfig b/drivers/gpu/drm/msm/Kconfig
|
||||
--- a/drivers/gpu/drm/msm/Kconfig
|
||||
+++ b/drivers/gpu/drm/msm/Kconfig
|
||||
@@ -50,14 +50,6 @@
|
||||
Only use this if you are a driver developer. This should *not*
|
||||
be enabled for production kernels. If unsure, say N.
|
||||
|
||||
-config DRM_MSM_VALIDATE_XML
|
||||
- bool "Validate XML register files against schema"
|
||||
- depends on DRM_MSM && EXPERT
|
||||
- depends on $(success,$(PYTHON3) -c "import lxml")
|
||||
- help
|
||||
- Validate XML files with register definitions against rules-fd schema.
|
||||
- This option is mostly targeting DRM MSM developers. If unsure, say N.
|
||||
-
|
||||
config DRM_MSM_KMS
|
||||
def_bool n
|
||||
depends on DRM_MSM
|
||||
@@ -28,6 +28,7 @@ with `../build/warden_defconfig` -> `zImage` + `rv1106-warden.dtb`).
|
||||
| `60-wifi-aic8800.patch` | out-of-tree AIC8800 wifi/BT (the 88.5K-line vendor blob) |
|
||||
| `70-audio-codec.patch` | `rv1106_codec` + I2S wiring |
|
||||
| `80-misc-thermal-rtc-adc.patch` | tsadc, rtc-rockchip, saradc, trng, otp, gmac, goodix touch |
|
||||
| `90-kconfig-no-python-symbol.patch` | drops `DRM_MSM_VALIDATE_XML` so the expanded `.config` (and `KCONFIG_SHA256`) does not depend on the host python (#19) |
|
||||
|
||||
## License
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
# Env:
|
||||
# BUSYBOX path to a local busybox binary (skips the download; still verified)
|
||||
# OUT output dir (default: qemu/out); initramfs at $OUT/initramfs.cpio.gz
|
||||
# EXTRA_DIR a directory merged into the initramfs root (a test's scripts and
|
||||
# static binaries; init runs one on warden.run=<path>)
|
||||
set -euo pipefail
|
||||
|
||||
QEMU_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
@@ -20,6 +22,12 @@ qemu_get_busybox
|
||||
SCRATCH="$(mktemp -d "${TMPDIR:-/tmp}/warden-qemu-initramfs.XXXXXX")"
|
||||
trap 'rm -rf "$SCRATCH"' EXIT
|
||||
qemu_stage_rootfs "$SCRATCH/root"
|
||||
# The kernel symbol list, so init can check it against /proc/config.gz.
|
||||
install -D -m 0644 "$QEMU_DIR/../build/required-symbols.txt" "$SCRATCH/root/etc/required-symbols.txt"
|
||||
if [ -n "${EXTRA_DIR:-}" ]; then
|
||||
[ -d "$EXTRA_DIR" ] || { echo "FATAL: EXTRA_DIR is not a directory: $EXTRA_DIR" >&2; exit 1; }
|
||||
cp -a "$EXTRA_DIR/." "$SCRATCH/root/"
|
||||
fi
|
||||
|
||||
# Pack (newc cpio, gzip). No device nodes required: /init mounts devtmpfs and
|
||||
# reopens the console itself, so the archive builds unprivileged.
|
||||
|
||||
@@ -18,6 +18,53 @@ mount -t sysfs sysfs /sys
|
||||
|
||||
echo "WARDEN-QEMU-BOOT-OK"
|
||||
|
||||
# Kernel contract (rebuild M0): every symbol of build/required-symbols.txt (staged
|
||||
# as /etc/required-symbols.txt by mkinitramfs.sh) is in the running kernel's
|
||||
# /proc/config.gz, the cgroup v2 controllers the platform limits with are there,
|
||||
# and pressure stall information is on. boot-smoke.sh greps these markers.
|
||||
if [ -r /etc/required-symbols.txt ]; then
|
||||
if [ -e /proc/config.gz ] && zcat /proc/config.gz > /config.run 2>/dev/null; then
|
||||
miss=""; nsym=0
|
||||
while read -r line; do
|
||||
case "$line" in
|
||||
CONFIG_*=*)
|
||||
nsym=$((nsym + 1))
|
||||
grep -qxF "$line" /config.run || miss="$miss $line" ;;
|
||||
"# CONFIG_"*" is not set")
|
||||
sym="${line#\# }"; sym="${sym% is not set}"; nsym=$((nsym + 1))
|
||||
grep -q "^$sym=" /config.run && miss="$miss ${sym}(set)" ;;
|
||||
esac
|
||||
done < /etc/required-symbols.txt
|
||||
if [ -z "$miss" ]; then echo "WARDEN-QEMU-SYMBOLS-OK $nsym"
|
||||
else echo "WARDEN-QEMU-SYMBOLS-MISSING$miss"; fi
|
||||
else
|
||||
echo "WARDEN-QEMU-SYMBOLS-MISSING /proc/config.gz"
|
||||
fi
|
||||
mkdir -p /sys/fs/cgroup
|
||||
mount -t cgroup2 none /sys/fs/cgroup 2>/dev/null
|
||||
echo "WARDEN-QEMU-CGROUP-CONTROLLERS $(cat /sys/fs/cgroup/cgroup.controllers 2>/dev/null)"
|
||||
psi_missing=""
|
||||
for f in cpu memory io; do [ -r "/proc/pressure/$f" ] || psi_missing="$psi_missing $f"; done
|
||||
if [ -z "$psi_missing" ]; then echo "WARDEN-QEMU-PSI-OK"; else echo "WARDEN-QEMU-PSI-MISSING$psi_missing"; fi
|
||||
fi
|
||||
|
||||
# warden.run=<path>: run a script that mkinitramfs.sh staged from EXTRA_DIR, then
|
||||
# power off. Used by the M0 limit tests (tools/m0/limits-test.sh in flare-edge).
|
||||
read -r CMDLINE < /proc/cmdline
|
||||
for w in $CMDLINE; do
|
||||
case "$w" in warden.run=*) RUN_SCRIPT="${w#warden.run=}" ;; esac
|
||||
done
|
||||
if [ -n "${RUN_SCRIPT:-}" ]; then
|
||||
if [ -x "$RUN_SCRIPT" ]; then
|
||||
echo "WARDEN-QEMU-RUN-BEGIN $RUN_SCRIPT"
|
||||
"$RUN_SCRIPT"
|
||||
echo "WARDEN-QEMU-RUN-END rc=$?"
|
||||
else
|
||||
echo "WARDEN-QEMU-RUN-MISSING $RUN_SCRIPT"
|
||||
fi
|
||||
poweroff -f
|
||||
fi
|
||||
|
||||
# With a virtio disk attached, hand over to the stage-1 rc (by-name symlinks,
|
||||
# slot select, switch_root). It only returns on failure; then fall through to
|
||||
# the diskless shell/poweroff behavior below.
|
||||
|
||||
@@ -25,6 +25,9 @@
|
||||
# --http-port N hostfwd 127.0.0.1:N -> guest :80 (default 8080; 0 disables)
|
||||
# --api-port N hostfwd 127.0.0.1:N -> guest :28443 (default 28443; 0 disables)
|
||||
# --shell interactive shell in the guest instead of daemon hold
|
||||
# --append STR extra kernel command line words (for example
|
||||
# warden.run=/m0/limits-test.sh: init runs that script from
|
||||
# the initramfs and powers off)
|
||||
# --allow-apply let flared ACTUALLY apply OTA firmware (writes rootfs_b
|
||||
# inside disk.img, safe in the VM, never the default)
|
||||
set -euo pipefail
|
||||
@@ -38,6 +41,7 @@ KERNEL="" INITRD="$OUT/initramfs.cpio.gz" DISK="" NO_DISK=0 SLOT="_a"
|
||||
RTC="" RS485="" CTL="" WATCHDOG=0 QMP="" DISPLAY_MODE="off" SHELL_FLAG=0 ALLOW_APPLY=0
|
||||
SSH_PORT=2222 HTTP_PORT=8080 API_PORT=28443
|
||||
EXTRA=()
|
||||
EXTRA_APPEND=""
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
@@ -56,6 +60,7 @@ while [ $# -gt 0 ]; do
|
||||
--http-port) HTTP_PORT="${2:?}"; shift 2 ;;
|
||||
--api-port) API_PORT="${2:?}"; shift 2 ;;
|
||||
--shell) SHELL_FLAG=1; shift ;;
|
||||
--append) EXTRA_APPEND="${2:?}"; shift 2 ;;
|
||||
--allow-apply) ALLOW_APPLY=1; shift ;;
|
||||
--) shift; EXTRA=("$@"); break ;;
|
||||
*) echo "FATAL: unknown argument '$1' (see header of $0)" >&2; exit 1 ;;
|
||||
@@ -111,6 +116,7 @@ if [ -n "$DISK" ] && [ "$NO_DISK" -eq 0 ]; then
|
||||
-device "virtio-blk-device,drive=vd0" )
|
||||
fi
|
||||
[ "$SHELL_FLAG" -eq 1 ] && APPEND="$APPEND warden.shell"
|
||||
[ -n "$EXTRA_APPEND" ] && APPEND="$APPEND $EXTRA_APPEND"
|
||||
# Tells init the FIRST 8250 is the control bridge. Without this marker init
|
||||
# bridges nothing, so a VM launched with --rs485 alone never has its Modbus
|
||||
# wire mistaken for the debug channel.
|
||||
|
||||
@@ -44,4 +44,20 @@ grep -q "WARDEN-QEMU-BOOT-OK" "$LOG" || {
|
||||
echo "FATAL: boot sentinel WARDEN-QEMU-BOOT-OK not found in console log" >&2
|
||||
exit 1
|
||||
}
|
||||
echo "boot smoke OK"
|
||||
# Kernel contract (rebuild M0): init checked build/required-symbols.txt against the
|
||||
# running kernel's /proc/config.gz, the cgroup v2 controllers and PSI. A missing
|
||||
# marker is as fatal as a MISSING one: the check must have run.
|
||||
grep -q "^WARDEN-QEMU-SYMBOLS-OK " "$LOG" || {
|
||||
echo "FATAL: the required-symbols check did not pass: $(grep -E 'WARDEN-QEMU-SYMBOLS' "$LOG" | head -1)" >&2
|
||||
exit 1
|
||||
}
|
||||
ctl="$(sed -n 's/^WARDEN-QEMU-CGROUP-CONTROLLERS //p' "$LOG" | head -1 | tr -d '\r')"
|
||||
for c in cpu memory pids; do
|
||||
case " $ctl " in *" $c "*) ;; *)
|
||||
echo "FATAL: cgroup v2 controller '$c' missing in the guest (have: '$ctl')" >&2; exit 1 ;; esac
|
||||
done
|
||||
grep -q "^WARDEN-QEMU-PSI-OK" "$LOG" || {
|
||||
echo "FATAL: pressure stall information is not available: $(grep -E 'WARDEN-QEMU-PSI' "$LOG" | head -1)" >&2
|
||||
exit 1
|
||||
}
|
||||
echo "boot smoke OK (symbols, cgroup controllers [$ctl], PSI)"
|
||||
|
||||
Executable
+43
@@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env bash
|
||||
# Offline test: the QEMU initramfs scripts pass the same shellcheck the qemu-tools CI job runs
|
||||
# (issue #18: `for w in $(cat /proc/cmdline)` failed it with SC2013), and the check really fires.
|
||||
# Skips with a notice when shellcheck is not installed (CI installs it).
|
||||
set -uo pipefail
|
||||
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
REPO="$(cd "$HERE/../.." && pwd)"
|
||||
TMP="$(mktemp -d)"; trap 'rm -rf "$TMP"' EXIT
|
||||
FAIL=0
|
||||
ok() { printf '[PASS] %s\n' "$1"; }
|
||||
bad() { printf '[FAIL] %s\n' "$1"; FAIL=1; }
|
||||
|
||||
if ! command -v shellcheck >/dev/null 2>&1; then
|
||||
echo "[SKIP] shellcheck is not installed"; exit 0
|
||||
fi
|
||||
|
||||
cd "$REPO" || exit 1
|
||||
if shellcheck -x qemu/rootfs/init qemu/rootfs/etc/rc qemu/rootfs/sbin/init > "$TMP/out" 2>&1; then
|
||||
ok "qemu/rootfs scripts pass shellcheck"
|
||||
else
|
||||
bad "qemu/rootfs scripts fail shellcheck"; head -20 "$TMP/out"
|
||||
fi
|
||||
|
||||
if grep -q 'read -r CMDLINE < /proc/cmdline' qemu/rootfs/init; then
|
||||
ok "init reads /proc/cmdline into a variable"
|
||||
else
|
||||
bad "init no longer reads /proc/cmdline into a variable"
|
||||
fi
|
||||
|
||||
# the old form must be red
|
||||
# shellcheck disable=SC2016 # the text is the literal old source line
|
||||
old_loop='for w in $(cat /proc/cmdline); do'
|
||||
sed -e '/^read -r CMDLINE < \/proc\/cmdline$/d' -e "s|^for w in \\\$CMDLINE; do\$|$old_loop|" qemu/rootfs/init > "$TMP/init-old"
|
||||
grep -qF "$old_loop" "$TMP/init-old" || bad "the doctored copy was not built"
|
||||
out="$(shellcheck -x "$TMP/init-old" 2>&1 || true)"
|
||||
if printf '%s' "$out" | grep -q 'SC2013'; then
|
||||
ok "doctored: the cat-in-a-for-loop form is reported as SC2013"
|
||||
else
|
||||
bad "doctored: the old form was not caught"
|
||||
fi
|
||||
|
||||
if [ "$FAIL" -eq 0 ]; then echo "ALL QEMU-INIT SHELLCHECK TESTS PASSED"; else echo "QEMU-INIT SHELLCHECK TESTS FAILED"; fi
|
||||
exit $FAIL
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
#!/usr/bin/env bash
|
||||
# The final kernel .config, and so KCONFIG_SHA256, must not depend on the host's python (issue #19):
|
||||
# DRM_MSM_VALIDATE_XML used to be visible only where python3 could import lxml, adding one line to the
|
||||
# file. Runs the config-only expansion twice, once with a python3 whose `import lxml` works and once with
|
||||
# one where it fails, and requires the same digest. Proven red on a copy of the tree without
|
||||
# patches/90-kconfig-no-python-symbol.patch (when this host's python3 has lxml; otherwise the red case
|
||||
# is skipped with a notice). Needs the pinned kernel tarball: KERNEL_TARBALL=<path>, or skipped.
|
||||
set -uo pipefail
|
||||
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
REPO="$(cd "$HERE/../.." && pwd)"
|
||||
TMP="$(mktemp -d)"; trap 'rm -rf "$TMP"' EXIT
|
||||
FAIL=0
|
||||
ok() { printf '[PASS] %s\n' "$1"; }
|
||||
bad() { printf '[FAIL] %s\n' "$1"; FAIL=1; }
|
||||
|
||||
if [ -z "${KERNEL_TARBALL:-}" ] || [ ! -f "$KERNEL_TARBALL" ]; then
|
||||
echo "[SKIP] set KERNEL_TARBALL to the pinned linux-6.18.46.tar.xz"; exit 0
|
||||
fi
|
||||
command -v python >/dev/null || { echo "[SKIP] needs 'python' on PATH (SDK quirk)"; exit 0; }
|
||||
REAL_PY="$(command -v python3)"
|
||||
|
||||
# a python3 on which `import lxml` fails, everything else passes through
|
||||
mkdir -p "$TMP/nolxml"
|
||||
cat > "$TMP/nolxml/python3" <<PYEOF
|
||||
#!/bin/sh
|
||||
case "\$*" in *"import lxml"*) exit 1 ;; esac
|
||||
exec "$REAL_PY" "\$@"
|
||||
PYEOF
|
||||
chmod +x "$TMP/nolxml/python3"
|
||||
# and one where it succeeds even if lxml is not installed
|
||||
mkdir -p "$TMP/lxml"
|
||||
cat > "$TMP/lxml/python3" <<PYEOF
|
||||
#!/bin/sh
|
||||
case "\$*" in *"import lxml"*) exit 0 ;; esac
|
||||
exec "$REAL_PY" "\$@"
|
||||
PYEOF
|
||||
chmod +x "$TMP/lxml/python3"
|
||||
|
||||
digest() { # digest <tree root> <path prefix dir>
|
||||
local root="$1" pfx="$2" work
|
||||
work="$(mktemp -d "$TMP/w.XXXXXX")"
|
||||
PATH="$pfx:$PATH" KERNEL_TARBALL="$KERNEL_TARBALL" WORK="$work" WARDEN_CONFIG_ONLY=1 \
|
||||
CONFIG_OUT="$work/final.config" CROSS_COMPILE="${CROSS_COMPILE:-arm-linux-gnueabihf-}" \
|
||||
bash "$root/build/build-kernel.sh" > "$work/log" 2>&1 || { tail -5 "$work/log" >&2; echo FAILED; return; }
|
||||
cat "$work/final.config.sha256"
|
||||
}
|
||||
|
||||
a="$(digest "$REPO" "$TMP/lxml")"; b="$(digest "$REPO" "$TMP/nolxml")"
|
||||
if [ "$a" != FAILED ] && [ "$a" = "$b" ]; then ok "the config digest is the same with and without a working import lxml ($a)"
|
||||
else bad "the config digest depends on the host python: with lxml $a, without $b"; fi
|
||||
|
||||
# red case: a tree without the patch
|
||||
mkdir -p "$TMP/old/patches"
|
||||
cp -r "$REPO/build" "$TMP/old/build"
|
||||
for p in "$REPO"/patches/*.patch; do [ "$(basename "$p")" = 90-kconfig-no-python-symbol.patch ] || cp "$p" "$TMP/old/patches/"; done
|
||||
oa="$(digest "$TMP/old" "$TMP/lxml")"; ob="$(digest "$TMP/old" "$TMP/nolxml")"
|
||||
if [ "$oa" = FAILED ] || [ "$ob" = FAILED ]; then bad "the doctored tree did not expand"
|
||||
elif [ "$oa" != "$ob" ]; then ok "doctored: without the patch the digests differ ($oa vs $ob), so this test can fail"
|
||||
else bad "doctored: the digests are equal even without the patch; the test proves nothing on this tarball"; fi
|
||||
|
||||
if [ "$FAIL" -eq 0 ]; then echo "ALL CONFIG-DETERMINISM TESTS PASSED"; else echo "CONFIG-DETERMINISM TESTS FAILED"; fi
|
||||
exit $FAIL
|
||||
+127
@@ -0,0 +1,127 @@
|
||||
#!/usr/bin/env bash
|
||||
# Offline tests for the required-symbols mechanism (rebuild M0):
|
||||
# build/lib-required-symbols.sh, the symbol lists, and build-kernel.sh's
|
||||
# WARDEN_CONFIG_ONLY entry checks. No kernel tarball, no compiler.
|
||||
#
|
||||
# What a regression here costs: olddefconfig drops a defconfig line whose symbol
|
||||
# or dependencies are missing without a word (flare-edge#533 shipped a firewall
|
||||
# that quietly skipped IPv6 that way), so the assertion against the final
|
||||
# .config is the only thing between a dropped symbol and a panel. This proves the
|
||||
# assertion itself fires, on fake .config files, for every failure shape.
|
||||
set -uo pipefail
|
||||
|
||||
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
REPO="$(cd "$HERE/../.." && pwd)"
|
||||
LIB="$REPO/build/lib-required-symbols.sh"
|
||||
REQ="$REPO/build/required-symbols.txt"
|
||||
PROBE="$REPO/build/probe-symbols.txt"
|
||||
TMP="$(mktemp -d)"; trap 'rm -rf "$TMP"' EXIT
|
||||
FAIL=0
|
||||
ok() { printf '[PASS] %s\n' "$1"; }
|
||||
bad() { printf '[FAIL] %s\n' "$1"; FAIL=1; }
|
||||
|
||||
# shellcheck source=build/lib-required-symbols.sh
|
||||
. "$LIB"
|
||||
|
||||
# A .config that satisfies a list: every =y line verbatim, every unset line
|
||||
# absent (Kconfig writes "# CONFIG_X is not set" for those).
|
||||
mkconfig() { # <list> <out>
|
||||
{ req_assertions "$1" | grep -v '^# '
|
||||
req_assertions "$1" | grep '^# '
|
||||
echo 'CONFIG_SOMETHING_ELSE=y'; } > "$2"
|
||||
}
|
||||
|
||||
# The probe list may be empty once every probe has passed (build-kernel.sh then skips it);
|
||||
# PROBES is the list to pass along: the probe list when it holds assertions, nothing otherwise.
|
||||
PROBES=(); [ -n "$(req_assertions "$PROBE")" ] && PROBES=("$PROBE")
|
||||
mkconfig "$REQ" "$TMP/good-req"; : > "$TMP/good-probe"; [ "${#PROBES[@]}" = 0 ] || mkconfig "$PROBE" "$TMP/good-probe"; cat "$TMP/good-req" "$TMP/good-probe" > "$TMP/good"
|
||||
req_assert_config "$TMP/good" "$REQ" ${PROBES[@]+"${PROBES[@]}"} >/dev/null 2>&1 \
|
||||
&& ok "a config that satisfies both lists passes" || bad "a satisfying config was refused"
|
||||
|
||||
n=$(req_assertions "$REQ" | wc -l)
|
||||
[ "$n" -ge 40 ] && ok "required-symbols.txt holds $n assertions" || bad "required-symbols.txt holds only $n assertions"
|
||||
|
||||
# every =y assertion must be refused when its line is missing, one at a time
|
||||
missing_ok=0; missing_bad=0
|
||||
while IFS= read -r line; do
|
||||
case "$line" in CONFIG_*=y) ;; *) continue ;; esac
|
||||
grep -vxF "$line" "$TMP/good" > "$TMP/cfg-missing"
|
||||
if req_assert_config "$TMP/cfg-missing" "$REQ" ${PROBES[@]+"${PROBES[@]}"} >/dev/null 2>&1; then missing_bad=$((missing_bad+1)); echo " not caught: $line"
|
||||
else missing_ok=$((missing_ok+1)); fi
|
||||
done < <(req_assertions "$REQ"; req_assertions "$PROBE")
|
||||
[ "$missing_bad" = 0 ] && ok "dropping any one of $missing_ok =y assertions fails the check" || bad "$missing_bad dropped symbols were not caught"
|
||||
|
||||
# =m is not =y
|
||||
sed 's/^CONFIG_NFT_CT=y$/CONFIG_NFT_CT=m/' "$TMP/good" > "$TMP/cfg-m"
|
||||
req_assert_config "$TMP/cfg-m" "$REQ" ${PROBES[@]+"${PROBES[@]}"} >/dev/null 2>&1 && bad "a modular symbol was accepted" || ok "a symbol built as a module is refused"
|
||||
|
||||
# unset assertions: a live value fails, absence and 'is not set' pass
|
||||
for sym in $(req_assertions "$REQ" | sed -n 's/^# \(CONFIG_[A-Z0-9_]*\) is not set$/\1/p'); do
|
||||
{ cat "$TMP/good"; echo "$sym=y"; } > "$TMP/cfg-set"
|
||||
req_assert_config "$TMP/cfg-set" "$REQ" ${PROBES[@]+"${PROBES[@]}"} >/dev/null 2>&1 && bad "$sym=y was accepted although it must stay unset" || ok "$sym=y is refused (must stay unset)"
|
||||
grep -vF "$sym" "$TMP/good" > "$TMP/cfg-absent"
|
||||
req_assert_config "$TMP/cfg-absent" "$REQ" ${PROBES[@]+"${PROBES[@]}"} >/dev/null 2>&1 && ok "$sym absent from the config is accepted" || bad "$sym absent from the config was refused"
|
||||
done
|
||||
|
||||
# No suspend (Noah 2026-10-09): CONFIG_SUSPEND and CONFIG_PM_SLEEP are asserted unset, the
|
||||
# defconfig carries the explicit unset (SUSPEND defaults to y), and a config that
|
||||
# turns either back on is refused by name.
|
||||
DEFCONFIG="$REPO/build/warden_defconfig"
|
||||
for sym in CONFIG_SUSPEND CONFIG_PM_SLEEP; do
|
||||
req_assertions "$REQ" | grep -qxF "# $sym is not set" \
|
||||
&& ok "required-symbols.txt asserts $sym unset" || bad "required-symbols.txt does not assert $sym unset"
|
||||
{ cat "$TMP/good"; echo "$sym=y"; } > "$TMP/cfg-suspend"
|
||||
out=$(req_assert_config "$TMP/cfg-suspend" "$REQ" ${PROBES[@]+"${PROBES[@]}"} 2>&1) && bad "$sym=y was accepted" \
|
||||
|| { printf '%s' "$out" | grep -q "$sym" && ok "$sym=y is refused naming $sym" || bad "$sym=y was refused without naming it"; }
|
||||
done
|
||||
grep -qxF '# CONFIG_SUSPEND is not set' "$DEFCONFIG" \
|
||||
&& ok "warden_defconfig carries the explicit # CONFIG_SUSPEND is not set" \
|
||||
|| bad "warden_defconfig lost the explicit # CONFIG_SUSPEND is not set (the Kconfig default is y)"
|
||||
grep -qE '^CONFIG_SUSPEND=' "$DEFCONFIG" && bad "warden_defconfig sets CONFIG_SUSPEND" || ok "warden_defconfig does not set CONFIG_SUSPEND"
|
||||
|
||||
# Probe V3 passed (2026-10-09): the hardware RNG symbols are required, the probe list is empty, and
|
||||
# the config digest does not move because the defconfig already built them in.
|
||||
for sym in CONFIG_HW_RANDOM CONFIG_HW_RANDOM_ROCKCHIP; do
|
||||
req_assertions "$REQ" | grep -qxF "$sym=y" && ok "required-symbols.txt asserts $sym=y (V3 passed)" || bad "required-symbols.txt lost $sym=y"
|
||||
grep -qxF "$sym=y" "$DEFCONFIG" && ok "warden_defconfig builds $sym in" || bad "warden_defconfig does not set $sym=y"
|
||||
{ cat "$TMP/good"; } | grep -vxF "$sym=y" > "$TMP/cfg-norng"
|
||||
out=$(req_assert_config "$TMP/cfg-norng" "$REQ" 2>&1) && bad "a config without $sym was accepted" \
|
||||
|| { printf '%s' "$out" | grep -q "$sym" && ok "a config without $sym is refused naming it" || bad "refusal did not name $sym"; }
|
||||
done
|
||||
[ -z "$(req_assertions "$PROBE")" ] && ok "probe-symbols.txt is empty: every probe has passed" \
|
||||
|| ok "probe-symbols.txt holds $(req_assertions "$PROBE" | wc -l) pending probe symbol(s)"
|
||||
|
||||
# fail-closed shapes
|
||||
: > "$TMP/empty"
|
||||
req_assert_config "$TMP/empty" "$REQ" >/dev/null 2>&1 && bad "an empty config was accepted" || ok "an empty config is refused"
|
||||
req_assert_config "$TMP/good" "$TMP/no-such-list" >/dev/null 2>&1 && bad "a missing list was accepted" || ok "a missing symbol list is refused"
|
||||
printf '## only comments\n# a comment\n' > "$TMP/no-assertions"
|
||||
req_assert_config "$TMP/good" "$TMP/no-assertions" >/dev/null 2>&1 && bad "a list with no assertions was accepted" || ok "a list with no assertions is refused"
|
||||
|
||||
# comment handling: a prose line starting "# CONFIG_" without "is not set" is a comment
|
||||
printf '## c\n# CONFIG_PROSE is the name of a thing\nCONFIG_REAL=y\n' > "$TMP/prose"
|
||||
[ "$(req_assertions "$TMP/prose")" = "CONFIG_REAL=y" ] && ok "a prose comment is not an assertion" || bad "a prose comment was parsed as an assertion"
|
||||
|
||||
# the lists: a symbol is asserted once, in one list
|
||||
dups=$( { req_assertions "$REQ"; req_assertions "$PROBE"; } | sed 's/^# //; s/ is not set//; s/=.*//' | sort | uniq -d | tr '\n' ' ')
|
||||
# a symbol that passed its probe moves to the required list; it must not stay in both
|
||||
[ -z "$dups" ] && ok "no symbol is asserted twice across the lists" || bad "symbols asserted twice: $dups"
|
||||
|
||||
# build-kernel.sh entry checks (they run before the tarball is touched)
|
||||
BK="$REPO/build/build-kernel.sh"
|
||||
out=$(WARDEN_CONFIG_ONLY=2 bash "$BK" 2>&1); rc=$?
|
||||
[ "$rc" != 0 ] && printf '%s' "$out" | grep -q 'WARDEN_CONFIG_ONLY must be 0 or 1' \
|
||||
&& ok "WARDEN_CONFIG_ONLY=2 is refused" || bad "WARDEN_CONFIG_ONLY=2 was not refused"
|
||||
mkdir -p "$TMP/bin"; printf '#!/bin/sh\nexit 0\n' > "$TMP/bin/python"; chmod +x "$TMP/bin/python"
|
||||
out=$(env -u WORK -u CONFIG_OUT PATH="$TMP/bin:$PATH" WARDEN_CONFIG_ONLY=1 bash "$BK" 2>&1); rc=$?
|
||||
[ "$rc" != 0 ] && printf '%s' "$out" | grep -q 'needs CONFIG_OUT' \
|
||||
&& ok "config-only with a scratch WORK and no CONFIG_OUT is refused (the result would be deleted)" \
|
||||
|| bad "config-only without CONFIG_OUT was not refused: $out"
|
||||
|
||||
# wiring text
|
||||
grep -q 'req_assert_config "\$SRC/.config" "\$REQ_SYMBOLS" \${PROBE_LISTS' "$BK" \
|
||||
&& ok "build-kernel.sh asserts both lists" || bad "build-kernel.sh does not assert the lists"
|
||||
grep -q 'for sym in CONFIG_' "$BK" && bad "build-kernel.sh has a hand-written symbol list again" || ok "build-kernel.sh has no hand-written list"
|
||||
|
||||
if [ "$FAIL" -eq 0 ]; then echo "ALL REQUIRED-SYMBOLS TESTS PASSED"; else echo "REQUIRED-SYMBOLS TESTS FAILED"; fi
|
||||
exit $FAIL
|
||||
Reference in New Issue
Block a user