Skip to content

Commit 3fffd2f

Browse files
committed
fix(build): make vmlinux extraction mandatory for x86_64 and fix CI pipeline
GNU gzip 1.12+ (Ubuntu 24.04) returns exit 2 on trailing garbage after a valid gzip stream in bzImage, killing extract-vmlinux.sh under pipefail. macOS gunzip tolerates this, so the bug only manifests in CI. The original kernel scripts/extract-vmlinux intentionally avoids strict mode for this reason. - extract-vmlinux.sh: add `|| true` to decompression pipeline so decompressor trailing-data exits don't abort the script; caller still validates output via PVH note check - extract-kernel.sh: remove silent fallback to vmlinuz on failure; vmlinux extraction or missing PVH note on x86_64 now fails the build (return 1) - release.yml: add nullglob before zstd compression loop since vmlinux is x86_64-only and the glob won't match for aarch64 artifacts
1 parent 3fb0b19 commit 3fffd2f

3 files changed

Lines changed: 16 additions & 14 deletions

File tree

.github/workflows/release.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,11 +328,13 @@ jobs:
328328
cp artifacts/vm-images-x86_64/* release/
329329
cp artifacts/vm-images-aarch64/* release/
330330
331-
# Compress large files
331+
# Compress large files (nullglob: vmlinux is x86_64 only, glob may not match for aarch64)
332332
cd release
333+
shopt -s nullglob
333334
for f in *.qcow2 vmlinux-* vmlinuz-* initramfs-*; do
334335
zstd -19 --rm "$f"
335336
done
337+
shopt -u nullglob
336338
337339
# Generate checksums
338340
sha256sum * > SHA256SUMS

scripts/extract-kernel.sh

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -144,20 +144,20 @@ extract_for_arch() {
144144
if [ "$target_arch" = "x86_64" ]; then
145145
local vmlinux_file="$OUTPUT_DIR/vmlinux-x86_64"
146146
echo "Extracting vmlinux for PVH boot..."
147-
if "$SCRIPT_DIR/extract-vmlinux.sh" "$vmlinuz_file" > "$vmlinux_file" 2>/dev/null; then
148-
chmod 644 "$vmlinux_file"
149-
# Verify PVH note exists (XEN_ELFNOTE_PHYS32_ENTRY)
150-
if docker run --rm -v "$OUTPUT_DIR:/output" --platform linux/amd64 \
151-
"alpine:$ALPINE_VERSION" sh -c "apk add --no-cache binutils >/dev/null 2>&1 && readelf -n /output/vmlinux-x86_64 2>/dev/null | grep -q Xen"; then
152-
echo "vmlinux-x86_64: PVH note verified ($(du -h "$vmlinux_file" | cut -f1))"
153-
else
154-
echo "Warning: vmlinux lacks PVH note, removing (will use vmlinuz)"
155-
rm -f "$vmlinux_file"
156-
fi
157-
else
158-
echo "Warning: vmlinux extraction failed (will use vmlinuz)"
147+
if ! "$SCRIPT_DIR/extract-vmlinux.sh" "$vmlinuz_file" > "$vmlinux_file" 2>/dev/null; then
148+
echo "ERROR: vmlinux extraction failed for x86_64" >&2
159149
rm -f "$vmlinux_file"
150+
return 1
160151
fi
152+
chmod 644 "$vmlinux_file"
153+
# Verify PVH note exists (XEN_ELFNOTE_PHYS32_ENTRY)
154+
if ! docker run --rm -v "$OUTPUT_DIR:/output" --platform linux/amd64 \
155+
"alpine:$ALPINE_VERSION" sh -c "apk add --no-cache binutils >/dev/null 2>&1 && readelf -n /output/vmlinux-x86_64 2>/dev/null | grep -q Xen"; then
156+
echo "ERROR: vmlinux lacks PVH note for x86_64" >&2
157+
rm -f "$vmlinux_file"
158+
return 1
159+
fi
160+
echo "vmlinux-x86_64: PVH note verified ($(du -h "$vmlinux_file" | cut -f1))"
161161
fi
162162
fi
163163

scripts/extract-vmlinux.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ try_decompress() {
2222
local offset
2323
offset=$(grep -aboP "$magic" "$BZIMAGE" 2>/dev/null | head -1 | cut -d: -f1) || true
2424
if [ -n "$offset" ]; then
25-
dd if="$BZIMAGE" bs=1 skip="$offset" 2>/dev/null | "$@" 2>/dev/null
25+
dd if="$BZIMAGE" bs=1 skip="$offset" 2>/dev/null | "$@" 2>/dev/null || true
2626
return 0
2727
fi
2828
return 1

0 commit comments

Comments
 (0)