qemu: build the panel's own BusyBox for the rig (flare-edge#2210)
ci / quality (push) Successful in 2m25s
ci / badges (push) Skipped
ci / mcdc (push) Successful in 29s
ci / prune-artifacts (push) Skipped
ci / test (push) Successful in 13s
ci / bench (push) Successful in 10s
ci / patches-apply (push) Successful in 24s
ci / kernel-build (push) Skipped
ci / mcdc (pull_request) Successful in 21s
ci / bench (pull_request) Successful in 17s
ci / test (pull_request) Successful in 14s
ci / prune-artifacts (pull_request) Skipped
ci / kernel-build (pull_request) Skipped
ci / qemu-tools (push) Successful in 4m32s
ci / kernel-symbols (push) Successful in 4m28s
ci / patches-apply (pull_request) Successful in 57s
ci / qemu-tools (pull_request) Successful in 3m8s
ci / kernel-symbols (pull_request) Successful in 6m42s
ci / quality (pull_request) Successful in 2m19s
ci / badges (pull_request) Skipped
ci / quality (push) Successful in 2m25s
ci / badges (push) Skipped
ci / mcdc (push) Successful in 29s
ci / prune-artifacts (push) Skipped
ci / test (push) Successful in 13s
ci / bench (push) Successful in 10s
ci / patches-apply (push) Successful in 24s
ci / kernel-build (push) Skipped
ci / mcdc (pull_request) Successful in 21s
ci / bench (pull_request) Successful in 17s
ci / test (pull_request) Successful in 14s
ci / prune-artifacts (pull_request) Skipped
ci / kernel-build (pull_request) Skipped
ci / qemu-tools (push) Successful in 4m32s
ci / kernel-symbols (push) Successful in 4m28s
ci / patches-apply (pull_request) Successful in 57s
ci / qemu-tools (pull_request) Successful in 3m8s
ci / kernel-symbols (pull_request) Successful in 6m42s
ci / quality (pull_request) Successful in 2m19s
ci / badges (pull_request) Skipped
The rig runs busybox.net's 1.31.0 multiarch binary, not the image's 1.37.0 with its applet config, so a script calling an applet or option the panel lacks (#1903 setpriv --reuid, #2002 stat, #1349 flock -w) passes in the rig and breaks on a panel. - qemu/busybox/panel.config: the image's config, rebuilt from Buildroot 2025.02.8 busybox.config plus 0001-busybox-applets.patch, resolved for 1.37.0 as Buildroot does. patches/: Buildroot's 11 busybox patches. rig.fragment: static link and BusyBox's own passwd readers only. applets.txt and help.txt: the bench a capture (image 417a66b). - qemu/build-busybox.sh: pinned 1.37.0 source, fails on any Kconfig rewrite of the config, an applet list other than the panel's, or a dynamic binary. - qemu/lib.sh: RIG_BUSYBOX=panel selects it (default stays multiarch); the bounded verified download is now qemu_fetch_verified. - warden.shell uses warden_console_shell: cttyhack where it exists, else setsid -c on the console tty (the panel's BusyBox has no cttyhack). - CI: offline tests in qemu-tools, a build there checked against every applet's --help from the panel through qemu-user, and a second boot smoke with the panel initramfs in kernel-build. Refs flare-edge#2210 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KerYPVh72hhNgKi3wS5ijG
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
4d30c3083b
commit
37037926df
@@ -178,6 +178,18 @@ jobs:
|
||||
if command -v busybox >/dev/null; then
|
||||
WARDEN_TEST_SH="busybox sh" bash qemu/tests/init-chain-test.sh
|
||||
fi
|
||||
- name: rig debug shell works without cttyhack (flare-edge#2210)
|
||||
# The panel's BusyBox has no cttyhack; warden.shell then opens the
|
||||
# console tty itself. Once more under busybox sh, the rig's own shell.
|
||||
run: |
|
||||
bash qemu/tests/console-shell-test.sh
|
||||
if command -v busybox >/dev/null; then
|
||||
WARDEN_TEST_SH="busybox sh" bash qemu/tests/console-shell-test.sh
|
||||
fi
|
||||
- name: panel BusyBox config and build helpers (flare-edge#2210)
|
||||
# panel.config carries the image's applet patch, the rig fragment only
|
||||
# changes linking, Kconfig rewrites and applet drift are caught: offline.
|
||||
run: bash qemu/tests/busybox-panel-test.sh
|
||||
- name: ui-drive.sh / ui-shot.sh UI start wait regression test (flare-edge#2295)
|
||||
# The console line that means "UI started" differs between a direct
|
||||
# start and a shipped init chain boot; every marker is checked
|
||||
@@ -247,6 +259,21 @@ jobs:
|
||||
run: bash qemu/mkinitramfs.sh
|
||||
- name: build A/B disk image
|
||||
run: bash qemu/mkimage.sh
|
||||
- name: cache panel BusyBox source
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: qemu/out/busybox-1.37.0.tar.bz2
|
||||
key: busybox-src-1.37.0
|
||||
- name: build the panel BusyBox and check it against the bench capture (flare-edge#2210)
|
||||
# The image's BusyBox version, applet config and Buildroot patches,
|
||||
# linked static (qemu/build-busybox.sh). Its applet list and every
|
||||
# applet's --help must equal the panel's own binary's (captured on
|
||||
# bench a), run here through qemu-user. Then an initramfs with it.
|
||||
run: |
|
||||
sudo apt-get install -y -qq gcc-arm-linux-gnueabihf qemu-user
|
||||
bash qemu/build-busybox.sh
|
||||
QEMU_USER="qemu-arm" bash qemu/tests/busybox-panel-help.sh
|
||||
RIG_BUSYBOX=panel bash qemu/mkinitramfs.sh
|
||||
|
||||
kernel-symbols:
|
||||
# The symbol gate (rebuild M0, kernel_symbols_exist): expand the real
|
||||
@@ -433,6 +460,11 @@ jobs:
|
||||
bash qemu/mkinitramfs.sh
|
||||
bash qemu/tests/boot-smoke.sh \
|
||||
"$RUNNER_TEMP/kbuild-out/linux-6.18.46/arch/arm/boot/zImage"
|
||||
# Once more with the panel's BusyBox (RIG_BUSYBOX=panel, flare-edge#2210).
|
||||
OUT="$RUNNER_TEMP/panel-rig" RIG_BUSYBOX=panel bash qemu/mkinitramfs.sh
|
||||
bash qemu/tests/boot-smoke.sh \
|
||||
"$RUNNER_TEMP/kbuild-out/linux-6.18.46/arch/arm/boot/zImage" \
|
||||
"$RUNNER_TEMP/panel-rig/initramfs.cpio.gz"
|
||||
# Best-effort: the build IS the gate. Uploading the zImage/dtb to GitHub
|
||||
# artifact storage can fail on an account-wide storage-quota hit (recalculated
|
||||
# every 6-12h) that has nothing to do with this build. Don't red-X a good
|
||||
|
||||
+5
-1
@@ -54,7 +54,8 @@ screenshot from here is not evidence about a 5.10 panel's Wi-Fi page.
|
||||
WORK=$HOME/kbuild-out CROSS_COMPILE=arm-linux-gnueabihf- \
|
||||
WARDEN_KCONFIG_FRAGMENT=qemu/configs/virt.fragment bash build/build-kernel.sh
|
||||
|
||||
# 2. initramfs (sha256-pinned static busybox + qemu/rootfs/) and A/B disk
|
||||
# 2. initramfs (sha256-pinned static busybox + qemu/rootfs/) and A/B disk;
|
||||
# RIG_BUSYBOX=panel builds the image's own BusyBox instead (qemu/busybox/)
|
||||
bash qemu/mkinitramfs.sh
|
||||
bash qemu/mkimage.sh # options: --portal-url --state K=V --fw-version
|
||||
|
||||
@@ -136,6 +137,9 @@ All take the virt-fragment `<zImage>`; `FLARE_EDGE=<checkout>` where noted.
|
||||
| `rootfs-overlay.sh` | - | offline, no VM: `mkimage.sh`'s `ROOTFS_OVERLAY` hook lays a directory of panel files (flare-edge's S03warden-accounts, S99lvgl, warden-ui-run) over the rootfs of both slots with their modes kept, beside the skeleton's own files; without it there is no `/etc/init.d`; an overlay that is not a directory, names anything but `etc/` and `usr/` at its top, or holds a symlink fails closed and writes no image; `ui-drive.sh --init-chain` refuses a missing directory or one without `etc/init.d/S99lvgl` before boot |
|
||||
| `init-chain-test.sh` | - | offline, no VM: `warden_init_chain` (rootfs/etc/warden-lib.sh) starts the executable `S<NN>*` scripts of a number range in name order, names a failing one and goes on, and counts them; `warden_rig_bus_owners` hands a bus credential to its account only when the rootfs has it; sbin/init runs S00-S09 before the bus and S10-S99 instead of the direct UI start on a `warden.initchain` boot (flare-edge #2210) |
|
||||
| `run-sh-args-test.sh` | - | offline, no VM: a fake `qemu-system-arm` captures run.sh's own argv and pins the ctl/rs485 pci-serial ordering contract rootfs/sbin/init's ttyS0-vs-ttyS1 alias depends on -- the ctl device always enumerates before rs485, warden.ctl only lands on the cmdline when --ctl is given, and an rs485 pci-serial device (real or null-backed) is always present so the port count never shifts |
|
||||
| `busybox-panel-test.sh` | - | offline, no VM: the panel BusyBox inputs (qemu/busybox/). panel.config carries every setting of the image's applet patch, rig.fragment changes only STATIC, USE_BB_PWD_GRP and USE_BB_SHADOW, a Kconfig rewrite of any setting and an applet the panel lacks fail the build, applets.txt and help.txt agree, and RIG_BUSYBOX refuses an unknown value or a prebuilt `BUSYBOX` (flare-edge#2210) |
|
||||
| `busybox-panel-help.sh [BIN]` | an ARM runner (binfmt or `QEMU_USER=qemu-arm`) | the built panel BusyBox against the bench capture: its applet list and every applet's `--help` equal the panel's own binary's. CI runs it in qemu-tools after `build-busybox.sh` |
|
||||
| `console-shell-test.sh` | - | offline, no VM: `warden_console_shell` (warden.shell) runs `setsid cttyhack sh` where cttyhack exists, else `setsid -c sh` on the console tty read from sysfs (the panel BusyBox has no cttyhack), else a plain sh. CI runs it under bash's `sh` and busybox `sh` |
|
||||
| `ctl-bridge-test.sh` | - | offline, no VM: runs the control bridge (`warden_ctl_bridge` in rootfs/etc/warden-lib.sh) against a fake warden-ui that answers some commands late. A reply slower than the old 5 s bound still arrives (the bound is now 30 s, `WARDEN_CTL_WAIT_S`), a timeout answers `bridge: no reply from warden-ui ...` (qmp.py raises it as a rig fault), and a timed-out command's late reply is drained instead of being read as the next command's answer (flare-edge #1448). A fake `wthctl` stands in for the hook client behind `@hookdoc`/`@hook` (flare-edge #2054): the pieces join into one request whose args are used once, only plain words reach the client, and a missing client or a request with no reply answers a `bridge:` line. CI runs it under bash's `sh` and busybox `sh` |
|
||||
| `init-rig-bus-test.sh` | - | offline, no VM: `warden_rig_bus` in rootfs/etc/warden-lib.sh against stub brokers. No broker in the payload creates nothing; a broker that listens gets the panel's layout (the `bus.sock` link, a 0400 64-hex credential per bus user, a config without password file, ACL or plugin); a broker that exits or never listens is reported within the bound; init starts the bus before the payload daemons. `WARDEN_TEST_MOSQUITTO_DIR` adds a real mosquitto carrying one message between two users logged in by credential file (flare-edge #1754) |
|
||||
| watchdog (`run.sh --watchdog`) | - | arm `/dev/watchdog`, don't pet: the VM resets ~30 s later (verified) |
|
||||
|
||||
@@ -0,0 +1,179 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build the rig's panel BusyBox: the image's BusyBox version with the image's
|
||||
# applet config, linked static for the rig's initramfs (flare-edge#2210).
|
||||
#
|
||||
# build-busybox.sh
|
||||
#
|
||||
# Env:
|
||||
# OUT output dir (default qemu/out); the binary lands at
|
||||
# $OUT/busybox-armv7l-panel, its input key next to it
|
||||
# CROSS_COMPILE cross toolchain prefix (default arm-linux-gnueabihf-)
|
||||
# BB_SRC_TARBALL a local busybox-$BB_SRC_VER.tar.bz2 (skips the download;
|
||||
# still verified against BB_SRC_SHA256)
|
||||
# JOBS make -j (default: nproc, at most 4)
|
||||
#
|
||||
# The inputs are pinned, not the output: the source tarball by sha256 and the
|
||||
# configuration by the committed files in qemu/busybox/. Compilers differ
|
||||
# between hosts, so one host's binary hash means nothing on another; the
|
||||
# output is checked by its applet list instead (qemu/busybox/applets.txt, the
|
||||
# same list as flare-edge tests/fixtures/panel-busybox-applets.txt). A rebuild
|
||||
# is skipped when the input key (tarball, config files, compiler version)
|
||||
# matches the cached binary's.
|
||||
#
|
||||
# FAILS CLOSED: no cross compiler, a bad tarball, a configuration that the
|
||||
# BusyBox Kconfig rewrites (a symbol the version does not know), an applet
|
||||
# list that differs, or a dynamically linked result is an error, never a
|
||||
# fallback to the multiarch binary.
|
||||
set -euo pipefail
|
||||
|
||||
QEMU_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
BB_DIR="$QEMU_DIR/busybox"
|
||||
|
||||
BB_SRC_VER=1.37.0
|
||||
BB_SRC_URL="https://busybox.net/downloads/busybox-${BB_SRC_VER}.tar.bz2"
|
||||
# From https://busybox.net/downloads/busybox-1.37.0.tar.bz2.sha256, the same
|
||||
# pin as Buildroot 2025.02.8 package/busybox/busybox.hash.
|
||||
BB_SRC_SHA256=3311dff32e746499f4df0d5df04d7eb396382d7e108bb9250e7b519b837043a4
|
||||
|
||||
# shellcheck source=qemu/lib.sh disable=SC1091
|
||||
. "$QEMU_DIR/lib.sh"
|
||||
|
||||
# Write the panel config with every fragment line applied: the symbol's old
|
||||
# setting (set or "is not set") is dropped and the fragment's line appended.
|
||||
# Usage: bb_apply_fragment PANEL_CONFIG FRAGMENT > .config
|
||||
bb_apply_fragment() {
|
||||
local panel="$1" frag="$2" line sym pat=""
|
||||
while IFS= read -r line; do
|
||||
case "$line" in ''|'#'*) continue ;; esac
|
||||
sym="${line%%=*}"
|
||||
case "$sym" in
|
||||
CONFIG_*) ;;
|
||||
*) echo "FATAL: bad fragment line: '$line'" >&2; return 1 ;;
|
||||
esac
|
||||
pat="${pat}|^${sym}=|^# ${sym} is not set\$"
|
||||
done < "$frag"
|
||||
if [ -n "$pat" ]; then
|
||||
grep -Ev "${pat#|}" "$panel" || true
|
||||
else
|
||||
cat "$panel"
|
||||
fi
|
||||
grep -Ev '^(#|$)' "$frag"
|
||||
}
|
||||
|
||||
# The settings of a config file, one per line, sorted: "SYM=value" for a set
|
||||
# symbol and "SYM is not set" for an unset one. Comments and the header are
|
||||
# dropped, so two configs compare by what they configure.
|
||||
bb_settings() {
|
||||
sed -n -e 's/^\(CONFIG_[A-Za-z0-9_]*=.*\)$/\1/p' \
|
||||
-e 's/^# \(CONFIG_[A-Za-z0-9_]*\) is not set$/\1 is not set/p' "$1" | LC_ALL=C sort
|
||||
}
|
||||
|
||||
# Fail when Kconfig changed any setting of the config it was given (WANT)
|
||||
# while writing GOT: a symbol this BusyBox version does not know, or one whose
|
||||
# dependencies are unmet, would otherwise be dropped without a word.
|
||||
bb_check_config() {
|
||||
local want="$1" got="$2" d
|
||||
if ! d="$(diff <(bb_settings "$want") <(bb_settings "$got"))"; then
|
||||
echo "FATAL: the BusyBox $BB_SRC_VER Kconfig rewrote the panel config (< given, > written):" >&2
|
||||
printf '%s\n' "$d" >&2
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Compare the applet names in a busybox.links file (one install path per line)
|
||||
# with the committed list. Usage: bb_check_applets LINKS APPLETS_TXT
|
||||
bb_check_applets() {
|
||||
local links="$1" want="$2" d
|
||||
if ! d="$(diff <(LC_ALL=C sort -u "$want") <(sed 's|.*/||' "$links" | LC_ALL=C sort -u))"; then
|
||||
echo "FATAL: the built BusyBox applet list differs from $want (< want, > built):" >&2
|
||||
printf '%s\n' "$d" >&2
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# The cache key: everything the binary is built from.
|
||||
bb_input_key() {
|
||||
local cc="$1"
|
||||
{
|
||||
echo "busybox $BB_SRC_VER $BB_SRC_SHA256"
|
||||
sha256sum "$BB_DIR/panel.config" "$BB_DIR/rig.fragment" "$BB_DIR/applets.txt" \
|
||||
"$BB_DIR"/patches/*.patch | awk '{print $1}'
|
||||
echo "$cc"
|
||||
"${cc}gcc" --version | head -n 1
|
||||
} | sha256sum | awk '{print $1}'
|
||||
}
|
||||
|
||||
bb_main() {
|
||||
local out="${OUT:-$QEMU_DIR/out}" cc="${CROSS_COMPILE:-arm-linux-gnueabihf-}"
|
||||
local jobs="${JOBS:-}" bin key src scratch tar
|
||||
bin="$out/busybox-armv7l-panel"
|
||||
command -v "${cc}gcc" >/dev/null || {
|
||||
echo "FATAL: no ${cc}gcc on PATH (apt-get install gcc-arm-linux-gnueabihf, or set CROSS_COMPILE)" >&2
|
||||
exit 1
|
||||
}
|
||||
if [ -z "$jobs" ]; then
|
||||
jobs="$(nproc)"; [ "$jobs" -le 4 ] || jobs=4
|
||||
fi
|
||||
mkdir -p "$out"
|
||||
key="$(bb_input_key "$cc")"
|
||||
if [ -f "$bin" ] && [ "$(cat "$bin.key" 2>/dev/null)" = "$key" ]; then
|
||||
qemu_log "panel busybox up to date ($bin)"
|
||||
return
|
||||
fi
|
||||
|
||||
tar="${BB_SRC_TARBALL:-$out/busybox-${BB_SRC_VER}.tar.bz2}"
|
||||
qemu_fetch_verified "$BB_SRC_URL" "$BB_SRC_SHA256" "$tar" "busybox ${BB_SRC_VER} source"
|
||||
|
||||
scratch="$(mktemp -d "${TMPDIR:-/tmp}/warden-busybox.XXXXXX")"
|
||||
# Expanded now on purpose: the trap must remove this run's directory.
|
||||
# shellcheck disable=SC2064
|
||||
trap "rm -rf '$scratch'" EXIT
|
||||
tar -xjf "$tar" -C "$scratch"
|
||||
src="$scratch/busybox-${BB_SRC_VER}"
|
||||
[ -d "$src" ] || { echo "FATAL: $tar has no busybox-${BB_SRC_VER}/" >&2; exit 1; }
|
||||
# Buildroot's patches for this version, as the image applies them.
|
||||
local p
|
||||
for p in "$BB_DIR"/patches/*.patch; do
|
||||
patch -d "$src" -p1 -s --no-backup-if-mismatch < "$p" || {
|
||||
echo "FATAL: $p does not apply to busybox $BB_SRC_VER" >&2
|
||||
exit 1
|
||||
}
|
||||
done
|
||||
|
||||
bb_apply_fragment "$BB_DIR/panel.config" "$BB_DIR/rig.fragment" > "$scratch/want.config"
|
||||
cp "$scratch/want.config" "$src/.config"
|
||||
# Fixed time stamps so two builds with one compiler give one binary.
|
||||
export SOURCE_DATE_EPOCH=0 KCONFIG_NOTIMESTAMP=1 KBUILD_BUILD_TIMESTAMP="1970-01-01"
|
||||
export KBUILD_BUILD_USER=warden KBUILD_BUILD_HOST=rig
|
||||
# oldconfig with no terminal: a symbol missing from the config would stop
|
||||
# at a prompt and read EOF; the settings check below names it either way.
|
||||
make -C "$src" -s CROSS_COMPILE="$cc" oldconfig </dev/null >"$scratch/oldconfig.log" 2>&1 || {
|
||||
cat "$scratch/oldconfig.log" >&2
|
||||
echo "FATAL: make oldconfig failed" >&2
|
||||
exit 1
|
||||
}
|
||||
bb_check_config "$scratch/want.config" "$src/.config"
|
||||
qemu_log "building busybox $BB_SRC_VER (panel config, static, ${cc}gcc, -j$jobs)"
|
||||
make -C "$src" -s -j"$jobs" CROSS_COMPILE="$cc" busybox busybox.links >"$scratch/make.log" 2>&1 || {
|
||||
tail -n 40 "$scratch/make.log" >&2
|
||||
echo "FATAL: busybox build failed" >&2
|
||||
exit 1
|
||||
}
|
||||
bb_check_applets "$src/busybox.links" "$BB_DIR/applets.txt"
|
||||
if "${cc}readelf" -l "$src/busybox" | grep -q 'INTERP'; then
|
||||
echo "FATAL: the built busybox is dynamically linked (CONFIG_STATIC not applied)" >&2
|
||||
exit 1
|
||||
fi
|
||||
"${cc}readelf" -h "$src/busybox" | grep -q 'Machine:.*ARM' || {
|
||||
echo "FATAL: the built busybox is not an ARM binary" >&2
|
||||
exit 1
|
||||
}
|
||||
install -m 0755 "$src/busybox" "$bin.tmp"
|
||||
mv -f "$bin.tmp" "$bin"
|
||||
printf '%s\n' "$key" > "$bin.key"
|
||||
qemu_log "panel busybox: $bin ($(sha256sum "$bin" | awk '{print $1}'))"
|
||||
}
|
||||
|
||||
if [ "${BASH_SOURCE[0]}" = "$0" ]; then
|
||||
bb_main "$@"
|
||||
fi
|
||||
@@ -0,0 +1,28 @@
|
||||
# The panel's BusyBox, for the rig
|
||||
|
||||
`RIG_BUSYBOX=panel` (qemu/lib.sh) makes the rig run the image's own BusyBox
|
||||
instead of the busybox.net 1.31.0 multiarch binary, so a script that calls an
|
||||
applet or option the panel lacks fails in the rig as it fails on a panel
|
||||
(flare-edge#2210; #1903 `setpriv --reuid`, #2002 `stat`, #1349 `flock -w`).
|
||||
`qemu/build-busybox.sh` builds it; the default stays `multiarch` until the
|
||||
flare-edge QEMU jobs switch over.
|
||||
|
||||
| File | What it is |
|
||||
|---|---|
|
||||
| `panel.config` | The image's BusyBox 1.37.0 configuration. Made from Buildroot 2025.02.8 `package/busybox/busybox.config` (the vendor SDK's base; its header matches the `a/` side of the applet patch), with `luckfox-sdk-patches/buildroot/patches/0001-busybox-applets.patch` applied and then `yes "" \| make oldconfig` in busybox-1.37.0, as Buildroot does for a config written for an older version (it adds TIME64, GETFATTR, FIND_EXEC_OK, IP_LINK_CAN and UDHCPD_BOOTP at their defaults and drops ASH_SLEEP). The time stamp line is dropped. |
|
||||
| `rig.fragment` | The rig's only differences: a static link, and BusyBox's own passwd, group and shadow readers (a static glibc binary cannot load NSS modules). Neither adds or removes an applet or option. |
|
||||
| `patches/` | Buildroot 2025.02.8's `package/busybox/*.patch`, applied in order like the image build does (one of them is what makes `tc` build with current kernel headers). Commit-message text was changed to ASCII; the diffs are unchanged. |
|
||||
| `applets.txt` | `busybox --list` of the panel (bench a, image 417a66b), the same as flare-edge `tests/fixtures/panel-busybox-applets.txt`. The build fails when its applet list differs. |
|
||||
| `help.txt` | `busybox <applet> --help` of every applet of the panel, the same as flare-edge `tests/fixtures/panel-busybox-help.txt` (flare-edge `tools/bench/busybox-help/capture.sh`). `qemu/tests/busybox-panel-help.sh` compares the built binary with it. |
|
||||
|
||||
The Buildroot fixups in `busybox.mk` that depend on the image's Buildroot
|
||||
options (mdev, init, watchdog, less flags, crypt SHA) are not applied here;
|
||||
the applet list and the per-applet help check would show any of them that
|
||||
changed an applet or an option. When the image's BusyBox changes, update
|
||||
`panel.config` and `patches/` the same way and re-capture `applets.txt` and
|
||||
`help.txt` from a panel.
|
||||
|
||||
The inputs are pinned (source tarball sha256, these files); the output is not,
|
||||
because each host's compiler gives a different binary. The cache key in
|
||||
`$OUT/busybox-armv7l-panel.key` covers the tarball, these files and the
|
||||
compiler version.
|
||||
@@ -0,0 +1,282 @@
|
||||
[
|
||||
[[
|
||||
addgroup
|
||||
adduser
|
||||
ar
|
||||
arch
|
||||
arp
|
||||
arping
|
||||
ascii
|
||||
ash
|
||||
awk
|
||||
base32
|
||||
base64
|
||||
basename
|
||||
bc
|
||||
blkid
|
||||
bunzip2
|
||||
bzcat
|
||||
cat
|
||||
chattr
|
||||
chgrp
|
||||
chmod
|
||||
chown
|
||||
chroot
|
||||
chrt
|
||||
chvt
|
||||
cksum
|
||||
clear
|
||||
cmp
|
||||
cp
|
||||
cpio
|
||||
crc32
|
||||
crond
|
||||
crontab
|
||||
cut
|
||||
date
|
||||
dc
|
||||
dd
|
||||
deallocvt
|
||||
delgroup
|
||||
deluser
|
||||
devmem
|
||||
df
|
||||
diff
|
||||
dirname
|
||||
dmesg
|
||||
dnsd
|
||||
dnsdomainname
|
||||
dos2unix
|
||||
du
|
||||
dumpkmap
|
||||
echo
|
||||
egrep
|
||||
eject
|
||||
env
|
||||
ether-wake
|
||||
expr
|
||||
factor
|
||||
fallocate
|
||||
false
|
||||
fbset
|
||||
fdflush
|
||||
fdformat
|
||||
fdisk
|
||||
fgrep
|
||||
find
|
||||
flock
|
||||
fold
|
||||
free
|
||||
freeramdisk
|
||||
fsck
|
||||
fsfreeze
|
||||
fstrim
|
||||
fuser
|
||||
getfattr
|
||||
getopt
|
||||
getty
|
||||
grep
|
||||
gunzip
|
||||
gzip
|
||||
halt
|
||||
hdparm
|
||||
head
|
||||
hexdump
|
||||
hexedit
|
||||
hostid
|
||||
hostname
|
||||
hwclock
|
||||
i2cdetect
|
||||
i2cdump
|
||||
i2cget
|
||||
i2cset
|
||||
i2ctransfer
|
||||
id
|
||||
ifconfig
|
||||
ifdown
|
||||
ifup
|
||||
inetd
|
||||
init
|
||||
insmod
|
||||
install
|
||||
ip
|
||||
ipaddr
|
||||
ipcrm
|
||||
ipcs
|
||||
iplink
|
||||
ipneigh
|
||||
iproute
|
||||
iprule
|
||||
iptunnel
|
||||
kill
|
||||
killall
|
||||
killall5
|
||||
klogd
|
||||
last
|
||||
less
|
||||
link
|
||||
linux32
|
||||
linux64
|
||||
linuxrc
|
||||
ln
|
||||
loadfont
|
||||
loadkmap
|
||||
logger
|
||||
login
|
||||
logname
|
||||
losetup
|
||||
ls
|
||||
lsattr
|
||||
lsmod
|
||||
lsof
|
||||
lspci
|
||||
lsscsi
|
||||
lsusb
|
||||
lzcat
|
||||
lzma
|
||||
lzopcat
|
||||
makedevs
|
||||
md5sum
|
||||
mdev
|
||||
mesg
|
||||
microcom
|
||||
mim
|
||||
mkdir
|
||||
mkdosfs
|
||||
mke2fs
|
||||
mkfifo
|
||||
mknod
|
||||
mkpasswd
|
||||
mkswap
|
||||
mktemp
|
||||
modprobe
|
||||
more
|
||||
mount
|
||||
mountpoint
|
||||
mt
|
||||
mv
|
||||
nameif
|
||||
netstat
|
||||
nice
|
||||
nl
|
||||
nohup
|
||||
nologin
|
||||
nproc
|
||||
nslookup
|
||||
nuke
|
||||
od
|
||||
openvt
|
||||
partprobe
|
||||
passwd
|
||||
paste
|
||||
patch
|
||||
pidof
|
||||
ping
|
||||
pipe_progress
|
||||
pivot_root
|
||||
poweroff
|
||||
printenv
|
||||
printf
|
||||
ps
|
||||
pwd
|
||||
rdate
|
||||
readlink
|
||||
readprofile
|
||||
realpath
|
||||
reboot
|
||||
renice
|
||||
reset
|
||||
resize
|
||||
resume
|
||||
rfkill
|
||||
rm
|
||||
rmdir
|
||||
rmmod
|
||||
route
|
||||
run-init
|
||||
run-parts
|
||||
runlevel
|
||||
sed
|
||||
seedrng
|
||||
seq
|
||||
setarch
|
||||
setconsole
|
||||
setfattr
|
||||
setkeycodes
|
||||
setlogcons
|
||||
setpriv
|
||||
setserial
|
||||
setsid
|
||||
sh
|
||||
sha1sum
|
||||
sha256sum
|
||||
sha3sum
|
||||
sha512sum
|
||||
shred
|
||||
sleep
|
||||
sort
|
||||
start-stop-daemon
|
||||
strings
|
||||
stty
|
||||
su
|
||||
sulogin
|
||||
svc
|
||||
svok
|
||||
swapoff
|
||||
swapon
|
||||
switch_root
|
||||
sync
|
||||
sysctl
|
||||
syslogd
|
||||
tail
|
||||
tar
|
||||
tc
|
||||
tee
|
||||
telnet
|
||||
telnetd
|
||||
test
|
||||
tftp
|
||||
time
|
||||
top
|
||||
touch
|
||||
tr
|
||||
traceroute
|
||||
tree
|
||||
true
|
||||
truncate
|
||||
ts
|
||||
tsort
|
||||
tty
|
||||
ubirename
|
||||
udhcpc
|
||||
uevent
|
||||
umount
|
||||
uname
|
||||
uniq
|
||||
unix2dos
|
||||
unlink
|
||||
unlzma
|
||||
unlzop
|
||||
unxz
|
||||
unzip
|
||||
uptime
|
||||
usleep
|
||||
uudecode
|
||||
uuencode
|
||||
vconfig
|
||||
vi
|
||||
vlock
|
||||
w
|
||||
watch
|
||||
watchdog
|
||||
wc
|
||||
wget
|
||||
which
|
||||
who
|
||||
whoami
|
||||
xargs
|
||||
xxd
|
||||
xz
|
||||
xzcat
|
||||
yes
|
||||
zcat
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,37 @@
|
||||
From e1690453cd84c798ca88cc4370710f65da86d986 Mon Sep 17 00:00:00 2001
|
||||
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
|
||||
Date: Sat, 5 Oct 2013 15:55:06 +0200
|
||||
Subject: [PATCH] networking/libiproute: use <linux/if_packet.h> instead of
|
||||
<net/if_packet.h>
|
||||
|
||||
The musl C library doesn't provide the <net/if_packet.h> since the
|
||||
corresponding kernel headers <linux/if_packet.h> already provides the
|
||||
necessary definitions. Replacing <net/if_packet.h> by
|
||||
<linux/if_packet.h> also removes the need to include
|
||||
<netpacket/packet.h>
|
||||
|
||||
This commit fixes the build of iplink with the musl C library.
|
||||
|
||||
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
|
||||
[Gustavo: update for busybox 1.22.0]
|
||||
Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
|
||||
---
|
||||
networking/libiproute/iplink.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/networking/libiproute/iplink.c b/networking/libiproute/iplink.c
|
||||
index 37ed114bc..bc526d89c 100644
|
||||
--- a/networking/libiproute/iplink.c
|
||||
+++ b/networking/libiproute/iplink.c
|
||||
@@ -7,7 +7,7 @@
|
||||
*/
|
||||
#include <net/if.h>
|
||||
/*#include <net/if_packet.h> - not needed? */
|
||||
-#include <netpacket/packet.h>
|
||||
+#include <linux/if_packet.h>
|
||||
#include <netinet/if_ether.h>
|
||||
|
||||
#include <linux/if_vlan.h>
|
||||
--
|
||||
2.48.1
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
From df20ae1280a2601a4c233ec12372d1e17db21e96 Mon Sep 17 00:00:00 2001
|
||||
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
|
||||
Date: Mon, 25 Nov 2013 22:51:53 +0100
|
||||
Subject: [PATCH] Makefile.flags: strip non -l arguments returned by pkg-config
|
||||
|
||||
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
|
||||
[yann.morin.1998@free.fr: refresh for 1.29.0]
|
||||
[petr.vorel@gmail.com: refresh for 1.32.0]
|
||||
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
|
||||
Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
|
||||
---
|
||||
Makefile.flags | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/Makefile.flags b/Makefile.flags
|
||||
index 97cb4dca2..92a9063d9 100644
|
||||
--- a/Makefile.flags
|
||||
+++ b/Makefile.flags
|
||||
@@ -181,7 +181,9 @@ ifeq ($(CONFIG_SELINUX),y)
|
||||
SELINUX_PC_MODULES = libselinux libsepol
|
||||
$(eval $(call pkg_check_modules,SELINUX,$(SELINUX_PC_MODULES)))
|
||||
CPPFLAGS += $(SELINUX_CFLAGS)
|
||||
-LDLIBS += $(if $(SELINUX_LIBS),$(SELINUX_LIBS:-l%=%),$(SELINUX_PC_MODULES:lib%=%))
|
||||
+LDLIBS += $(if $(SELINUX_LIBS),\
|
||||
+ $(patsubst -l%,%,$(filter -l%,$(SELINUX_LIBS))),\
|
||||
+ $(SELINUX_PC_MODULES:lib%=%))
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_FEATURE_NSLOOKUP_BIG),y)
|
||||
--
|
||||
2.48.1
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
From 68eaf20d86d4fe0f16a914817217f386155157cc Mon Sep 17 00:00:00 2001
|
||||
From: Ariadne Conill <ariadne@dereferenced.org>
|
||||
Date: Mon, 19 Sep 2022 14:15:12 +0200
|
||||
Subject: [PATCH] libbb: sockaddr2str: ensure only printable characters are
|
||||
returned for the hostname part
|
||||
|
||||
CVE: CVE-2022-28391
|
||||
Signed-off-by: Ariadne Conill <ariadne@dereferenced.org>
|
||||
Tested-by: Radoslav Kolev <radoslav.kolev@suse.com>
|
||||
Backport from ML: http://lists.busybox.net/pipermail/busybox/2022-July/089796.html
|
||||
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
|
||||
---
|
||||
libbb/xconnect.c | 5 +++--
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/libbb/xconnect.c b/libbb/xconnect.c
|
||||
index 0e0b247b8..02c061e67 100644
|
||||
--- a/libbb/xconnect.c
|
||||
+++ b/libbb/xconnect.c
|
||||
@@ -497,8 +497,9 @@ static char* FAST_FUNC sockaddr2str(const struct sockaddr *sa, int flags)
|
||||
);
|
||||
if (rc)
|
||||
return NULL;
|
||||
+ /* ensure host contains only printable characters */
|
||||
if (flags & IGNORE_PORT)
|
||||
- return xstrdup(host);
|
||||
+ return xstrdup(printable_string(host));
|
||||
#if ENABLE_FEATURE_IPV6
|
||||
if (sa->sa_family == AF_INET6) {
|
||||
if (strchr(host, ':')) /* heh, it's not a resolved hostname */
|
||||
@@ -509,7 +510,7 @@ static char* FAST_FUNC sockaddr2str(const struct sockaddr *sa, int flags)
|
||||
#endif
|
||||
/* For now we don't support anything else, so it has to be INET */
|
||||
/*if (sa->sa_family == AF_INET)*/
|
||||
- return xasprintf("%s:%s", host, serv);
|
||||
+ return xasprintf("%s:%s", printable_string(host), serv);
|
||||
/*return xstrdup(host);*/
|
||||
}
|
||||
|
||||
--
|
||||
2.48.1
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
From 56b84c6efb9a06ae294eb92cf9634f70af443b0a Mon Sep 17 00:00:00 2001
|
||||
From: Ariadne Conill <ariadne@dereferenced.org>
|
||||
Date: Mon, 19 Sep 2022 14:15:12 +0200
|
||||
Subject: [PATCH] nslookup: sanitize all printed strings with printable_string
|
||||
|
||||
Otherwise, terminal sequences can be injected, which enables various terminal injection
|
||||
attacks from DNS results.
|
||||
|
||||
CVE: CVE-2022-28391
|
||||
Signed-off-by: Ariadne Conill <ariadne@dereferenced.org>
|
||||
Tested-by: Radoslav Kolev <radoslav.kolev@suse.com>
|
||||
Backport from ML: http://lists.busybox.net/pipermail/busybox/2022-July/089795.html
|
||||
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
|
||||
---
|
||||
networking/nslookup.c | 10 +++++-----
|
||||
1 file changed, 5 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/networking/nslookup.c b/networking/nslookup.c
|
||||
index b67d354f7..79412477c 100644
|
||||
--- a/networking/nslookup.c
|
||||
+++ b/networking/nslookup.c
|
||||
@@ -784,7 +784,7 @@ static NOINLINE int parse_reply(const unsigned char *msg, size_t len)
|
||||
//printf("Unable to uncompress domain: %s\n", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
- printf(format, ns_rr_name(rr), dname);
|
||||
+ printf(format, ns_rr_name(rr), printable_string(dname));
|
||||
break;
|
||||
|
||||
case ns_t_mx:
|
||||
@@ -799,7 +799,7 @@ static NOINLINE int parse_reply(const unsigned char *msg, size_t len)
|
||||
//printf("Cannot uncompress MX domain: %s\n", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
- printf("%s\tmail exchanger = %d %s\n", ns_rr_name(rr), n, dname);
|
||||
+ printf("%s\tmail exchanger = %d %s\n", ns_rr_name(rr), n, printable_string(dname));
|
||||
break;
|
||||
|
||||
case ns_t_txt:
|
||||
@@ -811,7 +811,7 @@ static NOINLINE int parse_reply(const unsigned char *msg, size_t len)
|
||||
if (n > 0) {
|
||||
memset(dname, 0, sizeof(dname));
|
||||
memcpy(dname, ns_rr_rdata(rr) + 1, n);
|
||||
- printf("%s\ttext = \"%s\"\n", ns_rr_name(rr), dname);
|
||||
+ printf("%s\ttext = \"%s\"\n", ns_rr_name(rr), printable_string(dname));
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -831,7 +831,7 @@ static NOINLINE int parse_reply(const unsigned char *msg, size_t len)
|
||||
}
|
||||
|
||||
printf("%s\tservice = %u %u %u %s\n", ns_rr_name(rr),
|
||||
- ns_get16(cp), ns_get16(cp + 2), ns_get16(cp + 4), dname);
|
||||
+ ns_get16(cp), ns_get16(cp + 2), ns_get16(cp + 4), printable_string(dname));
|
||||
break;
|
||||
|
||||
case ns_t_soa:
|
||||
@@ -860,7 +860,7 @@ static NOINLINE int parse_reply(const unsigned char *msg, size_t len)
|
||||
return -1;
|
||||
}
|
||||
|
||||
- printf("\tmail addr = %s\n", dname);
|
||||
+ printf("\tmail addr = %s\n", printable_string(dname));
|
||||
cp += n;
|
||||
|
||||
printf("\tserial = %lu\n", ns_get32(cp));
|
||||
--
|
||||
2.48.1
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
From 9fed109be1f811069cb2f727e04c6996cd44b017 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Rapha=C3=ABl=20M=C3=A9lotte?= <raphael.melotte@mind.be>
|
||||
Date: Tue, 18 Apr 2023 15:54:43 +0200
|
||||
Subject: [PATCH] seedrng: fix getrandom() detection for non-glibc libc
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
glibc <= 2.24 does not provide getrandom(). A check for it has been
|
||||
added in 200a9669fbf6f06894e4243cccc9fc11a1a6073a and fixed in
|
||||
cb57abb46f06f4ede8d9ccbdaac67377fdf416cf.
|
||||
|
||||
However, building with a libc other than glibc can lead to the same
|
||||
problem as not every other libc has getrandom() either:
|
||||
|
||||
- uClibc provides it from v1.0.2 onwards, but requires to define
|
||||
_GNU_SOURCE (all versions - we already define it by default), and
|
||||
stddef to be included first (when using uClibc < 1.0.35 - we already
|
||||
include it through libbb.h).
|
||||
|
||||
- musl libc has getrandom(), but only from version 1.1.20 onwards. As
|
||||
musl does not provide __MUSL__ or version information, it's not
|
||||
possible to check for it like we did for glibc.
|
||||
|
||||
All of this makes it difficult (or impossible in case of musl) to
|
||||
check what we need to do to have getrandom() based on each libc
|
||||
versions.
|
||||
|
||||
On top of that, getrandom() is also not available on older kernels. As
|
||||
an example, when using a 3.10 kernel with uClibc 1.0.26, getrandom()
|
||||
is declared so compiling works, but it fails at link time because
|
||||
getrandom() is not defined.
|
||||
|
||||
To make it easier, take a similar approach to what was done for the
|
||||
crypt library: try to build a sample program to see if we have
|
||||
getrandom(). To keep it compatible with different versions of
|
||||
make (for reference see [1]), a variable for '#' is also introduced.
|
||||
|
||||
Based on the new Makefile variable, we now either use the
|
||||
libc-provided getrandom() when it's available, or use our own
|
||||
implementation when it's not (like it was the case already for glibc <
|
||||
2.25).
|
||||
|
||||
This should fix compiling with many libc/kernel combinations.
|
||||
|
||||
[1]: https://git.savannah.gnu.org/cgit/make.git/commit/?id=c6966b323811c37acedff05b576b907b06aea5f4
|
||||
|
||||
Signed-off-by: Raphael Melotte <raphael.melotte@mind.be>
|
||||
Upstream: http://lists.busybox.net/pipermail/busybox/2023-May/090317.html
|
||||
---
|
||||
Makefile.flags | 12 ++++++++++++
|
||||
miscutils/seedrng.c | 8 ++++----
|
||||
2 files changed, 16 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/Makefile.flags b/Makefile.flags
|
||||
index 92a9063d9..c8f601308 100644
|
||||
--- a/Makefile.flags
|
||||
+++ b/Makefile.flags
|
||||
@@ -162,6 +162,18 @@ ifeq ($(RT_AVAILABLE),y)
|
||||
LDLIBS += rt
|
||||
endif
|
||||
|
||||
+# GNU Make version 4.2.1 and earlier require number signs ('#')
|
||||
+# inside function invocations to be escaped, while versions 4.3+
|
||||
+# require them to be unescaped. Use a variable for it so that it works
|
||||
+# for both versions:
|
||||
+C := \#
|
||||
+# Not all libc versions have getrandom, so check for it:
|
||||
+HAVE_GETRANDOM := $(shell printf '$Cdefine _GNU_SOURCE\n$Cinclude <stddef.h>\n$Cinclude <sys/random.h>\nint main(void){char buf[256];\ngetrandom(buf,sizeof(buf),0);}' >bb_libtest.c; $(CC) $(CFLAGS) $(CFLAGS_busybox) -o /dev/null bb_libtest.c >/dev/null 2>&1 && echo "y"; rm bb_libtest.c)
|
||||
+
|
||||
+ifeq ($(HAVE_GETRANDOM),y)
|
||||
+CFLAGS += -DHAVE_GETRANDOM
|
||||
+endif
|
||||
+
|
||||
# libpam may use libpthread, libdl and/or libaudit.
|
||||
# On some platforms that requires an explicit -lpthread, -ldl, -laudit.
|
||||
# However, on *other platforms* it fails when some of those flags
|
||||
diff --git a/miscutils/seedrng.c b/miscutils/seedrng.c
|
||||
index 7a2331cb1..ba98f4d19 100644
|
||||
--- a/miscutils/seedrng.c
|
||||
+++ b/miscutils/seedrng.c
|
||||
@@ -44,8 +44,10 @@
|
||||
#include <linux/random.h>
|
||||
#include <sys/file.h>
|
||||
|
||||
-/* Fix up glibc <= 2.24 not having getrandom() */
|
||||
-#if defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ <= 24
|
||||
+/* Fix up some libc (e.g. glibc <= 2.24) not having getrandom() */
|
||||
+#if defined HAVE_GETRANDOM
|
||||
+#include <sys/random.h>
|
||||
+#else /* No getrandom */
|
||||
#include <sys/syscall.h>
|
||||
static ssize_t getrandom(void *buffer, size_t length, unsigned flags)
|
||||
{
|
||||
@@ -56,8 +58,6 @@ static ssize_t getrandom(void *buffer, size_t length, unsigned flags)
|
||||
return -1;
|
||||
# endif
|
||||
}
|
||||
-#else
|
||||
-#include <sys/random.h>
|
||||
#endif
|
||||
|
||||
/* Apparently some headers don't ship with this yet. */
|
||||
--
|
||||
2.48.1
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
From 7f0bb7f69f38298971aa8153d3fbe9b1fdda8ae7 Mon Sep 17 00:00:00 2001
|
||||
From: ctxnop <ctxnop@gmail.com>
|
||||
Date: Sun, 26 Jan 2025 20:59:20 +0100
|
||||
Subject: [PATCH] menuconfig: GCC failing saying ncurses is not found
|
||||
|
||||
Newer GCC increased diagnostics levels resulting in considering the
|
||||
test code to be invalid. The resulting message was misleading, saying
|
||||
that ncurses was not found, while the check failed for an unrelated
|
||||
reason which was hidden because GCC stderr was redirected to
|
||||
/dev/null.
|
||||
|
||||
Signed-off-by: ctxnop <ctxnop@gmail.com>
|
||||
Upstream: http://lists.busybox.net/pipermail/busybox/2024-July/090840.html
|
||||
[Fiona: rephrased commit message for clarity]
|
||||
Signed-off-by: Fiona Klute (WIWA) <fiona.klute@gmx.de>
|
||||
---
|
||||
scripts/kconfig/lxdialog/check-lxdialog.sh | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/scripts/kconfig/lxdialog/check-lxdialog.sh b/scripts/kconfig/lxdialog/check-lxdialog.sh
|
||||
index 5075ebf2d..08e4da3de 100755
|
||||
--- a/scripts/kconfig/lxdialog/check-lxdialog.sh
|
||||
+++ b/scripts/kconfig/lxdialog/check-lxdialog.sh
|
||||
@@ -45,9 +45,9 @@ trap "rm -f $tmp" 0 1 2 3 15
|
||||
|
||||
# Check if we can link to ncurses
|
||||
check() {
|
||||
- $cc -x c - -o $tmp 2>/dev/null <<'EOF'
|
||||
+ $cc -x c - -o $tmp <<'EOF'
|
||||
#include CURSES_LOC
|
||||
-main() {}
|
||||
+int main() { return 0; }
|
||||
EOF
|
||||
if [ $? != 0 ]; then
|
||||
echo " *** Unable to find the ncurses libraries or the" 1>&2
|
||||
--
|
||||
2.48.1
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
From 1dbb3073a3a8856b9446b882f797be1bb2e21a26 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= <u.kleine-koenig@pengutronix.de>
|
||||
Date: Mon, 23 Sep 2024 18:56:00 +0200
|
||||
Subject: [PATCH] tc: Fix compilation with Linux v6.8-rc1
|
||||
|
||||
Linux v6.8-rc1 removed the definitions related to CBQ:
|
||||
https://github.com/torvalds/linux/commit/33241dca486264193ed68167c8eeae1fb197f3df
|
||||
making tc fail to build.
|
||||
Add some #ifdefs to handle this missing support.
|
||||
|
||||
Upstream: http://lists.busybox.net/pipermail/busybox/2024-March/090678.html
|
||||
Bug report: https://bugs.busybox.net/show_bug.cgi?id=15931
|
||||
|
||||
Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
|
||||
---
|
||||
networking/tc.c | 12 ++++++++++++
|
||||
1 file changed, 12 insertions(+)
|
||||
|
||||
diff --git a/networking/tc.c b/networking/tc.c
|
||||
index 3a79fd2d9..d08fd1359 100644
|
||||
--- a/networking/tc.c
|
||||
+++ b/networking/tc.c
|
||||
@@ -231,6 +231,13 @@ static int cbq_parse_opt(int argc, char **argv, struct nlmsghdr *n)
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
+
|
||||
+#ifndef TCA_CBQ_MAX
|
||||
+/*
|
||||
+ * Linux v6.8-rc1~131^2~60^2^2 removed the uapi definitions for CBQ.
|
||||
+ * See https://git.kernel.org/linus/33241dca48626
|
||||
+ */
|
||||
+#else
|
||||
static int cbq_print_opt(struct rtattr *opt)
|
||||
{
|
||||
struct rtattr *tb[TCA_CBQ_MAX+1];
|
||||
@@ -322,6 +329,7 @@ static int cbq_print_opt(struct rtattr *opt)
|
||||
done:
|
||||
return 0;
|
||||
}
|
||||
+#endif
|
||||
|
||||
static FAST_FUNC int print_qdisc(
|
||||
const struct sockaddr_nl *who UNUSED_PARAM,
|
||||
@@ -372,8 +380,10 @@ static FAST_FUNC int print_qdisc(
|
||||
int qqq = index_in_strings(_q_, name);
|
||||
if (qqq == 0) { /* pfifo_fast aka prio */
|
||||
prio_print_opt(tb[TCA_OPTIONS]);
|
||||
+#ifdef TCA_CBQ_MAX
|
||||
} else if (qqq == 1) { /* class based queuing */
|
||||
cbq_print_opt(tb[TCA_OPTIONS]);
|
||||
+#endif
|
||||
} else {
|
||||
/* don't know how to print options for this qdisc */
|
||||
printf("(options for %s)", name);
|
||||
@@ -442,9 +452,11 @@ static FAST_FUNC int print_class(
|
||||
int qqq = index_in_strings(_q_, name);
|
||||
if (qqq == 0) { /* pfifo_fast aka prio */
|
||||
/* nothing. */ /*prio_print_opt(tb[TCA_OPTIONS]);*/
|
||||
+#ifdef TCA_CBQ_MAX
|
||||
} else if (qqq == 1) { /* class based queuing */
|
||||
/* cbq_print_copt() is identical to cbq_print_opt(). */
|
||||
cbq_print_opt(tb[TCA_OPTIONS]);
|
||||
+#endif
|
||||
} else {
|
||||
/* don't know how to print options for this class */
|
||||
printf("(options for %s)", name);
|
||||
--
|
||||
2.48.1
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
From 88f8a046f27cb81ccc30d038465e963b8300cf1b Mon Sep 17 00:00:00 2001
|
||||
From: Valery Ushakov <uwe@stderr.spb.ru>
|
||||
Date: Wed, 24 Jan 2024 22:24:41 +0300
|
||||
Subject: [PATCH] awk.c: fix CVE-2023-42366 (bug #15874)
|
||||
|
||||
Make sure we don't read past the end of the string in next_token()
|
||||
when backslash is the last character in an (invalid) regexp.
|
||||
a fix and issue reported in bugzilla
|
||||
|
||||
https://bugs.busybox.net/show_bug.cgi?id=15874
|
||||
|
||||
Upstream-Status: Submitted [http://lists.busybox.net/pipermail/busybox/2024-May/090766.html]
|
||||
|
||||
CVE: CVE-2023-42366
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
[Thomas: https://git.openembedded.org/openembedded-core/tree/meta/recipes-core/busybox/busybox/0001-awk.c-fix-CVE-2023-42366-bug-15874.patch?id=e0ff4813b1cf4df0d851c857d57fb88d7db51bdd]
|
||||
Upstream: http://lists.busybox.net/pipermail/busybox/2024-May/090766.html
|
||||
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
|
||||
---
|
||||
editors/awk.c | 6 ++++--
|
||||
1 file changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/editors/awk.c b/editors/awk.c
|
||||
index 64e752f4b..222e6298d 100644
|
||||
--- a/editors/awk.c
|
||||
+++ b/editors/awk.c
|
||||
@@ -1234,9 +1234,11 @@ static uint32_t next_token(uint32_t expected)
|
||||
s[-1] = bb_process_escape_sequence((const char **)&pp);
|
||||
if (*p == '\\')
|
||||
*s++ = '\\';
|
||||
- if (pp == p)
|
||||
+ if (pp == p) {
|
||||
+ if (*p == '\0')
|
||||
+ syntax_error(EMSG_UNEXP_EOS);
|
||||
*s++ = *p++;
|
||||
- else
|
||||
+ } else
|
||||
p = pp;
|
||||
}
|
||||
}
|
||||
--
|
||||
2.48.1
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
From 0583f8eda94f97e15e371e12458877b738439e8c Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Sun, 7 Mar 2021 17:30:24 -0800
|
||||
Subject: [PATCH] hwclock: Check for SYS_settimeofday before calling syscall
|
||||
|
||||
Some newer architectures e.g. RISCV32 have 64bit time_t from get go and
|
||||
thusly do not have gettimeofday_time64/settimeofday_time64 implemented
|
||||
therefore check for SYS_settimeofday definition before making the
|
||||
syscall. Fixes build for riscv32 and it will bail out at runtime.
|
||||
|
||||
Upstream-Status: Submitted [http://lists.busybox.net/pipermail/busybox/2021-March/088583.html]
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
Upstream: http://lists.busybox.net/pipermail/busybox/2021-March/088583.html
|
||||
[Thomas: this issue has been discussed on the musl mailing list, and
|
||||
the musl developers' opinion is that Busybox is wrong:
|
||||
https://www.openwall.com/lists/musl/2024/03/03/2
|
||||
https://www.openwall.com/lists/musl/2024/04/07/2. The correct fix
|
||||
isn't clear, and in the mean time, the patch from Khem turns the build
|
||||
issue into a runtime error only on the problematic architecture, which
|
||||
seems like a reasonable trade-off]
|
||||
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
|
||||
---
|
||||
util-linux/hwclock.c | 7 +++++--
|
||||
1 file changed, 5 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/util-linux/hwclock.c b/util-linux/hwclock.c
|
||||
index c3fd0eb57..dea9c9a55 100644
|
||||
--- a/util-linux/hwclock.c
|
||||
+++ b/util-linux/hwclock.c
|
||||
@@ -132,6 +132,7 @@ static void show_clock(const char **pp_rtcname, int utc)
|
||||
|
||||
static void set_kernel_tz(const struct timezone *tz)
|
||||
{
|
||||
+ int ret = 1;
|
||||
#if LIBC_IS_MUSL
|
||||
/* musl libc does not pass tz argument to syscall
|
||||
* because "it's deprecated by POSIX, therefore it's fine
|
||||
@@ -140,9 +141,11 @@ static void set_kernel_tz(const struct timezone *tz)
|
||||
#if !defined(SYS_settimeofday) && defined(SYS_settimeofday_time32)
|
||||
# define SYS_settimeofday SYS_settimeofday_time32
|
||||
#endif
|
||||
- int ret = syscall(SYS_settimeofday, NULL, tz);
|
||||
+#if defined(SYS_settimeofday)
|
||||
+ ret = syscall(SYS_settimeofday, NULL, tz);
|
||||
+#endif
|
||||
#else
|
||||
- int ret = settimeofday(NULL, tz);
|
||||
+ ret = settimeofday(NULL, tz);
|
||||
#endif
|
||||
if (ret)
|
||||
bb_simple_perror_msg_and_die("settimeofday");
|
||||
--
|
||||
2.48.1
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
From bba9e99026a3dafe75f608459533e0b6d8cf3874 Mon Sep 17 00:00:00 2001
|
||||
From: Andre Przywara <andre.przywara@arm.com>
|
||||
Date: Tue, 10 Sep 2024 14:32:46 +0100
|
||||
Subject: [PATCH] libbb/sha: add missing sha-NI guard
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The ENABLE_SHA1_HWACCEL Kconfig symbol is meant to be archicture
|
||||
agnostic, so can be enabled regardless of whether your build
|
||||
architecture provides hardware acceleration or not. At the moment only
|
||||
x86 implements this, so every piece of optimised code should be guarded
|
||||
by both ENABLE_SHA1_HWACCEL and (__x86_64__ || __i386__). This is missing
|
||||
at one place, so compiling for arm64 breaks when ENABLE_SHA1_HWACCEL is
|
||||
enabled:
|
||||
================================
|
||||
libbb/hash_md5_sha.c: In function 'sha1_end':
|
||||
libbb/hash_md5_sha.c:1316:28: error: 'sha1_process_block64_shaNI' undeclared (first use in this function); did you mean 'sha1_process_block64'?
|
||||
1316 | || ctx->process_block == sha1_process_block64_shaNI
|
||||
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
| sha1_process_block64
|
||||
libbb/hash_md5_sha.c:1316:28: note: each undeclared identifier is reported only once for each function it appears in
|
||||
make[1]: *** [scripts/Makefile.build:197: libbb/hash_md5_sha.o] Error 1
|
||||
make: *** [Makefile:744: libbb] Error 2
|
||||
================================
|
||||
|
||||
Add the missing guards around the call to sha1_process_block64_shaNI to
|
||||
fix the build on other architectures with ENABLE_SHA1_HWACCEL enabled.
|
||||
|
||||
Change-Id: I40bba388422625f4230abf15a5de23e1fdc654fc
|
||||
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
|
||||
Upstream: https://lists.busybox.net/pipermail/busybox/2024-September/090899.html
|
||||
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
|
||||
---
|
||||
libbb/hash_md5_sha.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/libbb/hash_md5_sha.c b/libbb/hash_md5_sha.c
|
||||
index 57a801459..75a61c32c 100644
|
||||
--- a/libbb/hash_md5_sha.c
|
||||
+++ b/libbb/hash_md5_sha.c
|
||||
@@ -1313,7 +1313,9 @@ unsigned FAST_FUNC sha1_end(sha1_ctx_t *ctx, void *resbuf)
|
||||
hash_size = 8;
|
||||
if (ctx->process_block == sha1_process_block64
|
||||
#if ENABLE_SHA1_HWACCEL
|
||||
+# if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
|
||||
|| ctx->process_block == sha1_process_block64_shaNI
|
||||
+# endif
|
||||
#endif
|
||||
) {
|
||||
hash_size = 5;
|
||||
--
|
||||
2.48.1
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
From 34d331d642c3312e1c04e4650f547f1a67abee24 Mon Sep 17 00:00:00 2001
|
||||
From: Andrej Valek <andrej.v@skyrain.eu>
|
||||
Date: Wed, 16 Oct 2024 10:15:08 +0200
|
||||
Subject: [PATCH] syslogd: fix wrong OPT_locallog flag detection
|
||||
|
||||
The OPT_locallog was set on "option_mask32" but checked on local
|
||||
"opts" variable. While this flag it's used on multiple places can't be
|
||||
has to be used with "option_mask32". Without this change syslogd
|
||||
is more-less unusable while no messages are logged locally.
|
||||
|
||||
Signed-off-by: Andrej Valek <andrej.v@skyrain.eu>
|
||||
Upstream: https://lists.busybox.net/pipermail/busybox/2024-October/090969.html
|
||||
[Thomas: this was reported as beeing needed by Bernd Kuhls at
|
||||
https://lore.kernel.org/buildroot/pan$de0bb$35c5a64$ca9b6f21$2408ff40@ID-313208.user.individual.net/,
|
||||
but also on the Busybox mailing list at
|
||||
https://lists.busybox.net/pipermail/busybox/2023-September/090499.html]
|
||||
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
|
||||
---
|
||||
sysklogd/syslogd.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c
|
||||
index 7558051f0..fa03aa280 100644
|
||||
--- a/sysklogd/syslogd.c
|
||||
+++ b/sysklogd/syslogd.c
|
||||
@@ -1179,7 +1179,7 @@ int syslogd_main(int argc UNUSED_PARAM, char **argv)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
- if (!ENABLE_FEATURE_REMOTE_LOG || (opts & OPT_locallog)) {
|
||||
+ if (!ENABLE_FEATURE_REMOTE_LOG || (option_mask32 & OPT_locallog)) {
|
||||
recvbuf[sz] = '\0'; /* ensure it *is* NUL terminated */
|
||||
split_escape_and_log(recvbuf, sz);
|
||||
}
|
||||
--
|
||||
2.48.1
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
# The rig's only differences from the panel's BusyBox config (panel.config).
|
||||
# Each line replaces the panel's setting for the same symbol. They change how
|
||||
# the binary links and looks up names, not which applets or options exist:
|
||||
# STATIC: the rig's initramfs has no shared libc, the panel's rootfs does.
|
||||
# USE_BB_PWD_GRP, USE_BB_SHADOW: a static glibc binary cannot load the NSS
|
||||
# modules getpwnam() needs, so BusyBox reads /etc/passwd, /etc/group and
|
||||
# /etc/shadow itself (the panel's uClibc-ng reads the same files).
|
||||
# qemu/tests/busybox-panel-test.sh refuses any other symbol here.
|
||||
CONFIG_STATIC=y
|
||||
CONFIG_USE_BB_PWD_GRP=y
|
||||
CONFIG_USE_BB_SHADOW=y
|
||||
+59
-28
@@ -7,30 +7,19 @@ BB_URL="https://busybox.net/downloads/binaries/${BB_VER}-defconfig-multiarch-mus
|
||||
|
||||
qemu_log() { printf '\033[36m== %s\033[0m\n' "$*"; }
|
||||
|
||||
# Fetch (or accept via $BUSYBOX) the pinned static armv7 busybox and verify it
|
||||
# against qemu/busybox.sha256. FAILS CLOSED: a missing pin refuses to build,
|
||||
# never silently skips verification, mirroring build/build-kernel.sh's
|
||||
# tarball handling. Sets $BB to the verified binary's path.
|
||||
qemu_get_busybox() {
|
||||
local sha_file="$QEMU_DIR/busybox.sha256"
|
||||
local out="${OUT:-$QEMU_DIR/out}"
|
||||
mkdir -p "$out"
|
||||
BB="${BUSYBOX:-$out/busybox-armv7l}"
|
||||
# Pin first: a missing pin refuses BEFORE downloading, same ordering as
|
||||
# build/fetch-kernel-tarball.sh.
|
||||
[ -f "$sha_file" ] || {
|
||||
echo "FATAL: no pinned sha256 for busybox (expected $sha_file): refusing to build from an unverified binary" >&2
|
||||
exit 1
|
||||
}
|
||||
local want got
|
||||
want="$(cat "$sha_file")"
|
||||
if [ -f "$BB" ]; then
|
||||
got="$(sha256sum "$BB" | awk '{print $1}')"
|
||||
# Download URL to DEST and verify it against the sha256 WANT. A DEST that
|
||||
# already matches is kept. FAILS CLOSED: three bounded attempts, then exit 1;
|
||||
# a mismatching download never lands at DEST.
|
||||
# Usage: qemu_fetch_verified URL WANT DEST LABEL
|
||||
qemu_fetch_verified() {
|
||||
local url="$1" want="$2" dest="$3" label="$4" got
|
||||
if [ -f "$dest" ]; then
|
||||
got="$(sha256sum "$dest" | awk '{print $1}')"
|
||||
if [ "$want" = "$got" ]; then
|
||||
qemu_log "busybox sha256 verified"
|
||||
qemu_log "$label sha256 verified"
|
||||
return
|
||||
fi
|
||||
qemu_log "cached busybox failed verification; fetching a clean copy"
|
||||
qemu_log "cached $label failed verification; fetching a clean copy"
|
||||
fi
|
||||
|
||||
# Every attempt is bounded: a server that answers and then stalls would
|
||||
@@ -40,27 +29,69 @@ qemu_get_busybox() {
|
||||
# shorten them through the environment.
|
||||
local stall="${BB_FETCH_STALL_SECS:-20}" max="${BB_FETCH_MAX_SECS:-60}"
|
||||
local delay="${BB_FETCH_RETRY_DELAY:-5}"
|
||||
local attempt tmp="${BB}.download.$$"
|
||||
local attempt tmp="${dest}.download.$$"
|
||||
rm -f "$tmp"
|
||||
for attempt in 1 2 3; do
|
||||
qemu_log "downloading $BB_URL (attempt $attempt/3)"
|
||||
qemu_log "downloading $url (attempt $attempt/3)"
|
||||
if curl --retry 1 --retry-delay "$delay" --retry-connrefused \
|
||||
--connect-timeout "$stall" --speed-limit 1024 --speed-time "$stall" \
|
||||
--max-time "$max" -fSL "$BB_URL" -o "$tmp"; then
|
||||
--max-time "$max" -fSL "$url" -o "$tmp"; then
|
||||
got="$(sha256sum "$tmp" | awk '{print $1}')"
|
||||
if [ "$want" = "$got" ]; then
|
||||
mv -f "$tmp" "$BB"
|
||||
qemu_log "busybox sha256 verified"
|
||||
mv -f "$tmp" "$dest"
|
||||
qemu_log "$label sha256 verified"
|
||||
return
|
||||
fi
|
||||
echo "busybox sha256 mismatch on attempt $attempt: want $want got $got" >&2
|
||||
echo "$label sha256 mismatch on attempt $attempt: want $want got $got" >&2
|
||||
fi
|
||||
rm -f "$tmp"
|
||||
done
|
||||
echo "FATAL: could not fetch pinned busybox after 3 verified attempts" >&2
|
||||
echo "FATAL: could not fetch pinned $label after 3 verified attempts" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Provide the rig's static armv7 busybox and set $BB to its path.
|
||||
#
|
||||
# RIG_BUSYBOX picks which one (flare-edge#2210):
|
||||
# multiarch (default) the busybox.net $BB_VER defconfig-multiarch-musl
|
||||
# binary, fetched (or accepted via $BUSYBOX) and
|
||||
# verified against qemu/busybox.sha256
|
||||
# panel the image's BusyBox version and applet config, built
|
||||
# from source by qemu/build-busybox.sh (needs a cross
|
||||
# compiler; checked by its applet list, see there)
|
||||
# FAILS CLOSED: a missing pin refuses to build, never silently skips
|
||||
# verification, mirroring build/build-kernel.sh's tarball handling; an
|
||||
# unknown RIG_BUSYBOX, or $BUSYBOX with the panel build, is refused.
|
||||
qemu_get_busybox() {
|
||||
local out="${OUT:-$QEMU_DIR/out}"
|
||||
mkdir -p "$out"
|
||||
case "${RIG_BUSYBOX:-multiarch}" in
|
||||
multiarch) ;;
|
||||
panel)
|
||||
[ -z "${BUSYBOX:-}" ] || {
|
||||
echo "FATAL: BUSYBOX=$BUSYBOX names a prebuilt binary; RIG_BUSYBOX=panel builds its own (unset one of them)" >&2
|
||||
exit 1
|
||||
}
|
||||
OUT="$out" bash "$QEMU_DIR/build-busybox.sh"
|
||||
BB="$out/busybox-armv7l-panel"
|
||||
return
|
||||
;;
|
||||
*)
|
||||
echo "FATAL: RIG_BUSYBOX must be multiarch or panel, not '${RIG_BUSYBOX}'" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
local sha_file="$QEMU_DIR/busybox.sha256"
|
||||
BB="${BUSYBOX:-$out/busybox-armv7l}"
|
||||
# Pin first: a missing pin refuses BEFORE downloading, same ordering as
|
||||
# build/fetch-kernel-tarball.sh.
|
||||
[ -f "$sha_file" ] || {
|
||||
echo "FATAL: no pinned sha256 for busybox (expected $sha_file): refusing to build from an unverified binary" >&2
|
||||
exit 1
|
||||
}
|
||||
qemu_fetch_verified "$BB_URL" "$(cat "$sha_file")" "$BB" busybox
|
||||
}
|
||||
|
||||
# Stage the shared rootfs skeleton (qemu/rootfs/ + busybox) into $1.
|
||||
# Requires qemu_get_busybox to have run (uses $BB).
|
||||
qemu_stage_rootfs() {
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
# the busybox skeleton; slot B keeps the skeleton as a known-good fallback.
|
||||
# Env:
|
||||
# BUSYBOX path to a local busybox binary (skips the download; still verified)
|
||||
# RIG_BUSYBOX multiarch (default) or panel: the image's own BusyBox, built by
|
||||
# qemu/build-busybox.sh (see qemu/busybox/README.md)
|
||||
# OUT output dir (default: qemu/out); image at $OUT/disk.img
|
||||
# PAYLOAD_DIR the directory whose binaries land in /usr/bin of both slots
|
||||
# (default qemu/payload). Lets one run boot its own payload set
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
#
|
||||
# Env:
|
||||
# BUSYBOX path to a local busybox binary (skips the download; still verified)
|
||||
# RIG_BUSYBOX multiarch (default) or panel: the image's own BusyBox, built by
|
||||
# qemu/build-busybox.sh (see qemu/busybox/README.md)
|
||||
# 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>)
|
||||
|
||||
@@ -54,6 +54,27 @@ warden_trap_power_signals() {
|
||||
trap 'echo "init: halt requested"; sync; ${WARDEN_POWEROFF_CMD:-poweroff -f}' USR1
|
||||
}
|
||||
|
||||
# The warden.shell interactive shell, on the console's real tty so it gets
|
||||
# job control. BusyBox's cttyhack does that where it is built in; the panel's
|
||||
# BusyBox (qemu/build-busybox.sh, RIG_BUSYBOX=panel) has no cttyhack, so the
|
||||
# tty is read from sysfs (the last console listed is /dev/console's) and
|
||||
# setsid -c makes it the controlling terminal (flare-edge#2210).
|
||||
# WARDEN_CONSOLE_ACTIVE and WARDEN_DEV_DIR point the host test at stand-ins.
|
||||
warden_console_shell() {
|
||||
if command -v cttyhack >/dev/null 2>&1; then
|
||||
setsid cttyhack sh
|
||||
return
|
||||
fi
|
||||
_wcs_tty="$(cat "${WARDEN_CONSOLE_ACTIVE:-/sys/class/tty/console/active}" 2>/dev/null)"
|
||||
_wcs_tty="${_wcs_tty##* }"
|
||||
if [ -n "$_wcs_tty" ] && [ -c "${WARDEN_DEV_DIR:-/dev}/$_wcs_tty" ]; then
|
||||
setsid -c sh <>"${WARDEN_DEV_DIR:-/dev}/$_wcs_tty" >&0 2>&1
|
||||
else
|
||||
echo "warden.shell: no console tty found; shell without job control"
|
||||
sh
|
||||
fi
|
||||
}
|
||||
|
||||
# Idle forever in a way a trapped signal interrupts at once: a foreground
|
||||
# `sleep` would hold the trap until it returned, up to an hour later.
|
||||
warden_idle_forever() {
|
||||
|
||||
+3
-1
@@ -75,7 +75,9 @@ fi
|
||||
|
||||
if grep -qw warden.shell /proc/cmdline; then
|
||||
echo "warden.shell: interactive shell (exit to power off)"
|
||||
setsid cttyhack sh
|
||||
# shellcheck source=qemu/rootfs/etc/warden-lib.sh disable=SC1091
|
||||
. /etc/warden-lib.sh
|
||||
warden_console_shell
|
||||
fi
|
||||
|
||||
poweroff -f
|
||||
|
||||
@@ -48,7 +48,7 @@ mount_fatal() {
|
||||
echo "WARDEN-QEMU-MOUNT-FAILED $1"
|
||||
if grep -qw warden.shell /proc/cmdline; then
|
||||
echo "warden.shell: post-mortem shell (exit powers off)"
|
||||
setsid cttyhack sh
|
||||
warden_console_shell
|
||||
fi
|
||||
poweroff -f
|
||||
fi
|
||||
@@ -231,7 +231,7 @@ fi
|
||||
|
||||
if grep -qw warden.shell /proc/cmdline; then
|
||||
echo "warden.shell: interactive shell (exit powers off)"
|
||||
setsid cttyhack sh
|
||||
warden_console_shell
|
||||
poweroff -f
|
||||
fi
|
||||
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env bash
|
||||
# Check a built panel BusyBox against the bench capture (flare-edge#2210):
|
||||
# its applet list must equal qemu/busybox/applets.txt and every applet's
|
||||
# --help text must equal qemu/busybox/help.txt, which lists the options each
|
||||
# applet of the panel's own binary accepts. The binary is ARM: the host runs
|
||||
# it through binfmt, or through $QEMU_USER (e.g. qemu-arm) when set.
|
||||
#
|
||||
# bash qemu/tests/busybox-panel-help.sh [BIN] (default qemu/out/busybox-armv7l-panel)
|
||||
set -euo pipefail
|
||||
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
BB_DIR="$HERE/../busybox"
|
||||
BIN="${1:-$HERE/../out/busybox-armv7l-panel}"
|
||||
[ -x "$BIN" ] || { echo "FATAL: no busybox binary at $BIN (run qemu/build-busybox.sh)" >&2; exit 1; }
|
||||
export LC_ALL=C
|
||||
SCRATCH="$(mktemp -d "${TMPDIR:-/tmp}/bb-panel-help.XXXXXX")"
|
||||
trap 'rm -rf "$SCRATCH"' EXIT
|
||||
# Word splitting is wanted: QEMU_USER may carry arguments.
|
||||
# shellcheck disable=SC2206
|
||||
RUN=(${QEMU_USER:-} "$BIN")
|
||||
|
||||
"${RUN[@]}" --list | sort > "$SCRATCH/list.txt" || {
|
||||
echo "FATAL: $BIN does not run here (no binfmt for ARM? set QEMU_USER=qemu-arm)" >&2
|
||||
exit 1
|
||||
}
|
||||
if ! diff -u <(sort "$BB_DIR/applets.txt") "$SCRATCH/list.txt"; then
|
||||
echo "FAIL: the applet list differs from qemu/busybox/applets.txt (- panel, + built)" >&2
|
||||
exit 1
|
||||
fi
|
||||
# Same shape as flare-edge tools/bench/busybox-help/capture.sh: the banner
|
||||
# line (version and build date) and blank lines dropped.
|
||||
while IFS= read -r a; do
|
||||
echo "== $a"
|
||||
"${RUN[@]}" "$a" --help 2>&1 | sed 1d | sed '/^$/d' || true
|
||||
done < "$SCRATCH/list.txt" > "$SCRATCH/help.txt"
|
||||
if ! diff -u <(grep -v '^#' "$BB_DIR/help.txt") "$SCRATCH/help.txt"; then
|
||||
echo "FAIL: --help differs from the panel's (qemu/busybox/help.txt; - panel, + built)" >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "busybox-panel-help: $(wc -l < "$SCRATCH/list.txt") applets, list and --help equal to the panel's"
|
||||
@@ -0,0 +1,141 @@
|
||||
#!/usr/bin/env bash
|
||||
# Offline checks for the rig's panel BusyBox inputs (qemu/busybox/,
|
||||
# qemu/build-busybox.sh, RIG_BUSYBOX in qemu/lib.sh), flare-edge#2210. No
|
||||
# compiler, network or VM: the build helpers run against small stand-in files.
|
||||
#
|
||||
# bash qemu/tests/busybox-panel-test.sh
|
||||
set -uo pipefail
|
||||
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
QEMU_DIR="$(cd "$HERE/.." && pwd)"
|
||||
REPO="$(cd "$QEMU_DIR/.." && pwd)"
|
||||
BB_DIR="$QEMU_DIR/busybox"
|
||||
SCRATCH="$(mktemp -d "${TMPDIR:-/tmp}/bb-panel-test.XXXXXX")"
|
||||
trap 'rm -rf "$SCRATCH"' EXIT
|
||||
FAIL=0
|
||||
pass() { printf '[PASS] %s\n' "$1"; }
|
||||
fail() { printf '[FAIL] %s\n' "$1"; FAIL=1; }
|
||||
export LC_ALL=C
|
||||
|
||||
# shellcheck source=qemu/build-busybox.sh disable=SC1091
|
||||
. "$QEMU_DIR/build-busybox.sh"
|
||||
# The sourced script sets -e for its own run; these checks report each failure.
|
||||
set +e
|
||||
|
||||
# 1. Every setting the image's applet patch makes is in the panel config.
|
||||
PATCH="$REPO/luckfox-sdk-patches/buildroot/patches/0001-busybox-applets.patch"
|
||||
missing="$(sed -n -e 's/^+\(CONFIG_[A-Za-z0-9_]*=.*\)$/\1/p' \
|
||||
-e 's/^+\(# CONFIG_[A-Za-z0-9_]* is not set\)$/\1/p' "$PATCH" |
|
||||
while IFS= read -r l; do grep -qxF -- "$l" "$BB_DIR/panel.config" || printf '%s\n' "$l"; done)"
|
||||
n="$(grep -cE '^\+(CONFIG_|# CONFIG_)' "$PATCH")"
|
||||
if [ "$n" -gt 0 ] && [ -z "$missing" ]; then
|
||||
pass "panel.config carries all $n settings of the image's applet patch"
|
||||
else
|
||||
fail "panel.config lacks settings of $PATCH: ${missing:-none read}"
|
||||
fi
|
||||
|
||||
# 2. The rig differs from the panel only in linking and name lookup.
|
||||
got="$(grep -Ev '^(#|$)' "$BB_DIR/rig.fragment" | sed 's/=.*//' | sort | tr '\n' ' ')"
|
||||
if [ "$got" = "CONFIG_STATIC CONFIG_USE_BB_PWD_GRP CONFIG_USE_BB_SHADOW " ]; then
|
||||
pass "rig.fragment sets only STATIC, USE_BB_PWD_GRP and USE_BB_SHADOW"
|
||||
else
|
||||
fail "rig.fragment sets symbols beyond linking and name lookup: $got"
|
||||
fi
|
||||
|
||||
# 3. Applying the fragment replaces exactly its symbols.
|
||||
bb_apply_fragment "$BB_DIR/panel.config" "$BB_DIR/rig.fragment" > "$SCRATCH/rig.config"
|
||||
d="$(diff <(bb_settings "$BB_DIR/panel.config") <(bb_settings "$SCRATCH/rig.config"))"
|
||||
want_d="$(printf '%s\n' '< CONFIG_STATIC is not set' '< CONFIG_USE_BB_PWD_GRP is not set' \
|
||||
'< CONFIG_USE_BB_SHADOW is not set' '> CONFIG_STATIC=y' '> CONFIG_USE_BB_PWD_GRP=y' \
|
||||
'> CONFIG_USE_BB_SHADOW=y')"
|
||||
if [ "$(grep -E '^[<>]' <<<"$d" | sort)" = "$want_d" ]; then
|
||||
pass "the rig config is the panel config with the three fragment lines"
|
||||
else
|
||||
fail "the rig config differs from the panel config by: $d"
|
||||
fi
|
||||
printf 'CONFIG_A=y\n# CONFIG_B is not set\nCONFIG_C="x"\n' > "$SCRATCH/p.config"
|
||||
printf '# note\nNOT_A_SYMBOL=y\n' > "$SCRATCH/bad.fragment"
|
||||
if ! bb_apply_fragment "$SCRATCH/p.config" "$SCRATCH/bad.fragment" >/dev/null 2>"$SCRATCH/frag.err" &&
|
||||
grep -q 'bad fragment line' "$SCRATCH/frag.err"; then
|
||||
pass "a fragment line that is not CONFIG_* is refused"
|
||||
else
|
||||
fail "a bad fragment line was accepted"
|
||||
fi
|
||||
|
||||
# 4. A Kconfig rewrite of any setting fails and names it.
|
||||
cp "$SCRATCH/p.config" "$SCRATCH/same.config"
|
||||
printf '#\n# a header\n' >> "$SCRATCH/same.config"
|
||||
if bb_check_config "$SCRATCH/p.config" "$SCRATCH/same.config" 2>/dev/null; then
|
||||
pass "a config that only gained comments passes the rewrite check"
|
||||
else
|
||||
fail "the rewrite check failed a config with the same settings"
|
||||
fi
|
||||
printf 'CONFIG_A=y\nCONFIG_C="x"\n' > "$SCRATCH/dropped.config"
|
||||
if ! bb_check_config "$SCRATCH/p.config" "$SCRATCH/dropped.config" 2>"$SCRATCH/cfg.err" &&
|
||||
grep -q 'CONFIG_B is not set' "$SCRATCH/cfg.err"; then
|
||||
pass "a setting Kconfig dropped fails the rewrite check, named"
|
||||
else
|
||||
fail "a dropped setting passed the rewrite check"
|
||||
fi
|
||||
|
||||
# 5. The applet check compares names, not install paths.
|
||||
printf 'b\na\n' > "$SCRATCH/applets.txt"
|
||||
printf '/bin/a\n/usr/sbin/b\n' > "$SCRATCH/ok.links"
|
||||
printf '/bin/a\n/usr/sbin/b\n/usr/bin/timeout\n' > "$SCRATCH/extra.links"
|
||||
if bb_check_applets "$SCRATCH/ok.links" "$SCRATCH/applets.txt" 2>/dev/null; then
|
||||
pass "the same applets under install paths pass"
|
||||
else
|
||||
fail "matching applets failed the applet check"
|
||||
fi
|
||||
if ! bb_check_applets "$SCRATCH/extra.links" "$SCRATCH/applets.txt" 2>"$SCRATCH/app.err" &&
|
||||
grep -q '> timeout' "$SCRATCH/app.err"; then
|
||||
pass "an applet the panel lacks fails the applet check, named"
|
||||
else
|
||||
fail "an extra applet passed the applet check"
|
||||
fi
|
||||
|
||||
# 6. The two bench fixtures agree: applets.txt is help.txt's applet list.
|
||||
if [ -s "$BB_DIR/applets.txt" ] && [ -z "$(sort "$BB_DIR/applets.txt" | uniq -d)" ] &&
|
||||
[ "$(sort "$BB_DIR/applets.txt")" = "$(sed -n 's/^== //p' "$BB_DIR/help.txt" | sort)" ]; then
|
||||
pass "applets.txt ($(wc -l < "$BB_DIR/applets.txt") applets) matches help.txt"
|
||||
else
|
||||
fail "applets.txt and help.txt list different applets (or duplicates)"
|
||||
fi
|
||||
|
||||
# 7. RIG_BUSYBOX refusals, before any download or build.
|
||||
run_get() { (QEMU_DIR="$QEMU_DIR" OUT="$SCRATCH/out" qemu_get_busybox) >/dev/null 2>"$SCRATCH/get.err"; }
|
||||
if ! RIG_BUSYBOX=bogus run_get && grep -q 'RIG_BUSYBOX must be multiarch or panel' "$SCRATCH/get.err"; then
|
||||
pass "an unknown RIG_BUSYBOX is refused"
|
||||
else
|
||||
fail "an unknown RIG_BUSYBOX was accepted"
|
||||
fi
|
||||
if ! RIG_BUSYBOX=panel BUSYBOX=/nonexistent run_get && grep -q 'names a prebuilt binary' "$SCRATCH/get.err"; then
|
||||
pass "RIG_BUSYBOX=panel with BUSYBOX set is refused"
|
||||
else
|
||||
fail "RIG_BUSYBOX=panel accepted a prebuilt BUSYBOX"
|
||||
fi
|
||||
|
||||
# 8. No cross compiler: the build fails closed, it never falls back.
|
||||
if ! CROSS_COMPILE=no-such-cross- OUT="$SCRATCH/out" bash "$QEMU_DIR/build-busybox.sh" >/dev/null 2>"$SCRATCH/cc.err" &&
|
||||
grep -q 'no no-such-cross-gcc on PATH' "$SCRATCH/cc.err" && [ ! -e "$SCRATCH/out/busybox-armv7l-panel" ]; then
|
||||
pass "a missing cross compiler fails the build with no binary"
|
||||
else
|
||||
fail "the build did not fail closed without a cross compiler"
|
||||
fi
|
||||
|
||||
# 9. The Buildroot patches are there and every one is a patch.
|
||||
np=0
|
||||
for p in "$BB_DIR"/patches/*.patch; do
|
||||
grep -q '^+++ ' "$p" || fail "$p has no diff"
|
||||
np=$((np + 1))
|
||||
done
|
||||
if [ "$np" -eq 11 ]; then
|
||||
pass "the 11 Buildroot 2025.02.8 busybox patches are present"
|
||||
else
|
||||
fail "expected 11 Buildroot busybox patches, found $np"
|
||||
fi
|
||||
|
||||
if [ "$FAIL" -ne 0 ]; then
|
||||
echo "busybox-panel: FAILED"
|
||||
exit 1
|
||||
fi
|
||||
echo "busybox-panel: all checks passed"
|
||||
@@ -0,0 +1,78 @@
|
||||
#!/usr/bin/env bash
|
||||
# Offline test for warden_console_shell (qemu/rootfs/etc/warden-lib.sh), the
|
||||
# warden.shell debug shell: with cttyhack it runs `setsid cttyhack sh` as
|
||||
# before; without it (the panel's BusyBox, RIG_BUSYBOX=panel) it opens the
|
||||
# console's tty from sysfs and runs `setsid -c sh` on it; with no tty it says
|
||||
# so and runs a plain sh (flare-edge#2210). Stub commands record each call.
|
||||
#
|
||||
# bash qemu/tests/console-shell-test.sh (WARDEN_TEST_SH="busybox sh" for the rig's shell)
|
||||
set -uo pipefail
|
||||
HERE="$(cd "$(dirname "$0")" && pwd)"
|
||||
LIB="$HERE/../rootfs/etc/warden-lib.sh"
|
||||
SH="${WARDEN_TEST_SH:-sh}"
|
||||
WORK="$(mktemp -d "${TMPDIR:-/tmp}/console-shell.XXXXXX")" || exit 1
|
||||
trap 'rm -rf "$WORK"' EXIT
|
||||
FAIL=0
|
||||
pass() { printf '[PASS] %s\n' "$1"; }
|
||||
fail() { printf '[FAIL] %s\n' "$1"; FAIL=1; }
|
||||
|
||||
# Stubs: setsid and sh record their argv and where stdin points.
|
||||
mkdir -p "$WORK/bin" "$WORK/bin-ctty"
|
||||
for c in setsid sh; do
|
||||
# The single-quoted text is the stub's own source.
|
||||
# shellcheck disable=SC2016
|
||||
printf '#!/bin/sh\necho "%s $*" >> "$CALLS"\nreadlink /proc/self/fd/0 >> "$CALLS"\n' "$c" > "$WORK/bin/$c"
|
||||
chmod 0755 "$WORK/bin/$c"
|
||||
done
|
||||
cp "$WORK/bin/setsid" "$WORK/bin/sh" "$WORK/bin-ctty/"
|
||||
printf '#!/bin/sh\nexit 0\n' > "$WORK/bin-ctty/cttyhack"
|
||||
chmod 0755 "$WORK/bin-ctty/cttyhack"
|
||||
|
||||
# run_case <stub dir> <console active file>: the calls the helper made.
|
||||
# The helper runs with only the stub dir and the host's basic tools on PATH,
|
||||
# so a host cttyhack (none expected) cannot leak in.
|
||||
run_case() {
|
||||
local calls="$WORK/calls.$RANDOM"
|
||||
: > "$calls"
|
||||
# $SH may carry arguments ("busybox sh"): split on purpose.
|
||||
# shellcheck disable=SC2086
|
||||
CALLS="$calls" WARDEN_CONSOLE_ACTIVE="$2" WARDEN_DEV_DIR=/dev \
|
||||
$SH -c ". '$LIB'; PATH='$1':/usr/bin:/bin; warden_console_shell" < /dev/zero > "$WORK/out" 2>&1
|
||||
cat "$calls"
|
||||
}
|
||||
|
||||
printf 'tty1 null\n' > "$WORK/active"
|
||||
got="$(run_case "$WORK/bin-ctty" "$WORK/active")"
|
||||
if [ "$(head -n 1 <<<"$got")" = "setsid cttyhack sh" ]; then
|
||||
pass "with cttyhack: setsid cttyhack sh"
|
||||
else
|
||||
fail "with cttyhack the helper ran: $got"
|
||||
fi
|
||||
|
||||
got="$(run_case "$WORK/bin" "$WORK/active")"
|
||||
if [ "$got" = "$(printf 'setsid -c sh\n/dev/null')" ]; then
|
||||
pass "without cttyhack: setsid -c sh on the last console tty (/dev/null stand-in)"
|
||||
else
|
||||
fail "without cttyhack the helper ran: $got"
|
||||
fi
|
||||
|
||||
got="$(run_case "$WORK/bin" "$WORK/no-such-active")"
|
||||
if [ "$(head -n 1 <<<"$got")" = "sh " ] && grep -q 'no console tty found' "$WORK/out"; then
|
||||
pass "no console tty: says so and runs a plain sh"
|
||||
else
|
||||
fail "with no console tty the helper ran: $got ($(cat "$WORK/out"))"
|
||||
fi
|
||||
|
||||
printf 'ttyNOPE\n' > "$WORK/active-bad"
|
||||
got="$(run_case "$WORK/bin" "$WORK/active-bad")"
|
||||
if [ "$(head -n 1 <<<"$got")" = "sh " ]; then
|
||||
pass "a console name with no device node: plain sh, no setsid -c"
|
||||
else
|
||||
fail "a missing tty node ran: $got"
|
||||
fi
|
||||
|
||||
if [ "$FAIL" -ne 0 ]; then
|
||||
echo "console-shell: FAILED"
|
||||
exit 1
|
||||
fi
|
||||
echo "console-shell: all checks passed"
|
||||
@@ -41,6 +41,9 @@ scripts=(
|
||||
"tests/mk-bootimg/run-boot-img-validate-tests.sh"
|
||||
"tests/mk-bootimg/run-help-tests.sh"
|
||||
"tests/mk-bootimg/run-ci-wiring-tests.sh"
|
||||
"qemu/tests/busybox-panel-test.sh"
|
||||
"qemu/tests/busybox-panel-help.sh"
|
||||
"qemu/tests/console-shell-test.sh"
|
||||
)
|
||||
|
||||
fail=0
|
||||
|
||||
Reference in New Issue
Block a user