archlinux-s390x/scripts
Mathieu Benoit 0da64c9933 [FIX] rm -rf followed a bind mount into the host's /dev
make_rootfs wiped the rootfs with `rm -rf "$ROOT"` and no check on what was
mounted under it. A diagnostic session had left `mount --rbind /dev "$ROOT/dev"`
in place; the next run deleted straight through it into the real /dev. Every
device node went -- zero, full, random, urandom, tty, console -- and /dev/null
came back later as a regular file created by a redirection, which broke every
`> /dev/null` on the machine and stopped the pass at its first pacman call.

Two guards now, because unmounting alone is not enough: umount_chroot, then
findmnt to CHECK, then refuse. A stale mount is a reason to stop, never a thing
to delete through.

/dev is also no longer written to at all. The bind became --rbind with
--make-rslave, which brings the host's /dev/shm along as the tmpfs it already is
-- so the separate tmpfs and the chmod that reached the host are both gone. That
chmod was the reason this driver could touch /dev in the first place.

The plain --bind was itself the original bug: it does not carry submounts, so the
chroot saw /dev/shm as an empty 0755 stub, CPython's configure got EACCES from
sem_open, and python was built without POSIX semaphores.

--- FR ---

make_rootfs effaçait le rootfs par `rm -rf "$ROOT"` sans vérifier ce qui était
monté dessous. Une session de diagnostic avait laissé `mount --rbind /dev
"$ROOT/dev"` en place ; l'exécution suivante a supprimé au travers, dans le /dev
réel. Tous les nœuds de périphériques ont disparu — zero, full, random, urandom,
tty, console — et /dev/null est revenu en fichier ordinaire créé par une
redirection, ce qui a cassé tout `> /dev/null` sur la machine et arrêté la passe
à son premier appel à pacman.

Deux gardes désormais, car démonter ne suffit pas : umount_chroot, puis findmnt
pour VÉRIFIER, puis refuser. Un montage résiduel est une raison de s'arrêter,
jamais une chose à traverser.

Et /dev n'est plus écrit du tout. Le bind devient --rbind avec --make-rslave, ce
qui apporte le /dev/shm de l'hôte tel qu'il est déjà — un tmpfs — donc le tmpfs
séparé et le chmod qui atteignait l'hôte disparaissent tous deux. Ce chmod était
la raison pour laquelle ce pilote pouvait toucher /dev.

Le --bind simple était lui-même le défaut d'origine : il ne porte pas les
sous-montages, le chroot voyait donc /dev/shm comme une souche vide en 0755, le
configure de CPython recevait EACCES de sem_open, et python était bâti sans
sémaphores POSIX.

Assisted-by: Claude Opus 5
2026-08-24 01:14:35 -04:00
..
devtools [FIX] libdir: the Debian host hid the libraries from Arch 2026-08-17 01:33:41 -04:00
bootstrap-pacman.sh [FIX] a hook's scope belongs to its sections, not to its filename 2026-08-23 17:23:30 -04:00
build-arch-kernel.sh making the house a home 2026-01-27 23:26:31 +01:00
build-busybox-zvm.sh making the house a home 2026-01-27 23:26:31 +01:00
build-container.sh making the house a home 2026-01-27 23:26:31 +01:00
build-initramfs-final.sh making the house a home 2026-01-27 23:26:31 +01:00
build-stage1.sh [FIX] stage 2: the build tools the host was providing silently 2026-08-20 01:34:41 -04:00
build-stage2.sh [FIX] rm -rf followed a bind mount into the host's /dev 2026-08-24 01:14:35 -04:00
build-systemd-zvm.sh making the house a home 2026-01-27 23:26:31 +01:00
check-private.sh [ADD] upstream.lock, and keep the machine out of the repository 2026-08-22 22:52:04 -04:00
common.sh cleaned up scripts to be more DRY 2025-06-05 20:48:16 +02:00
create-rootfs.sh making the house a home 2026-01-27 23:26:31 +01:00
deploy-and-build-systemd-zvm.sh cleaned up scripts to be more DRY 2025-06-05 20:48:16 +02:00
lib-watch.sh [FIX] stage 2: the build tools the host was providing silently 2026-08-20 01:34:41 -04:00
packages.sh [ADD] gyp for nss, and jsoncpp's doxygen output 2026-08-24 00:03:26 -04:00
prepare-boot.sh making the house a home 2026-01-27 23:26:31 +01:00
test-chroot.sh [FIX] ARTEFACT condemned two correct packages 2026-08-24 00:46:33 -04:00
test-qemu.sh cleaned up scripts to be more DRY 2025-06-05 20:48:16 +02:00
upstream-lock.sh [ADD] upstream.lock, and keep the machine out of the repository 2026-08-22 22:52:04 -04:00
upstream.lock [ADD] upstream.lock, and keep the machine out of the repository 2026-08-22 22:52:04 -04:00
zvm-utils.sh cleaned up scripts to be more DRY 2025-06-05 20:48:16 +02:00