deb: unmount and remove the ephemeral chroot on Ctrl-C

The SIGINT handler libc::_exit(130)s, skipping EphemeralContextGuard's
drop and leaking the freshly bootstrapped chroot with its bind-mounted
/proc and overlay mounts. Resources now register a self-contained
cleanup hook in a process-global registry that the handler drains right
before exiting: the hook unmounts everything under the chroot path
(children first, lazy fallback) and removes the tree, using only stored
paths and direct umount/rm subprocesses so it cannot deadlock on a lock
the interrupted thread may hold; sudo -n keeps it from ever hanging on
a password prompt. Drop deregisters the hook first, so the normal
cleanup path is unchanged.

Also fixes the hex grouping of the CRC-24 polynomial in apt::release.
This commit is contained in:
2026-09-16 01:55:35 +02:00
parent 93176aa479
commit 512a1cb778
4 changed files with 513 additions and 4 deletions
+1 -1
View File
@@ -1037,7 +1037,7 @@ fn crc24(data: &[u8]) -> u32 {
for _ in 0..8 {
crc <<= 1;
if crc & 0x100_0000 != 0 {
crc ^= 0x1864_CFB;
crc ^= 0x0186_4CFB;
}
}
}