[Yaird-devel] Bug#391446: yaird: Free memory by nuking rootfs before switching root

Peter Colberg peterco at gmx.net
Fri Oct 6 15:23:35 UTC 2006


Package: yaird
Version: 0.0.12-18
Severity: wishlist

Asking myself whether the memory occupied by initramfs is freed after
the real init process has taken over, I found a mention in the kernel
docs (filesystems/ramfs-rootfs-initramfs.txt) that files from the
initramfs have to be deleted manually before switching root in order
to free up the space, and that there exists a helper program to do
this rather tricky job, namely utils/run_init.c from klibc.

However, with yaird, the relevant nuke_dir function in exec/run_init.c
has been replaced by an empty stub since over a year ago (2005-03-01),
reasoning that nuking of rootfs has not been tested.


Of course, the few megabytes currently wasted by an initrd generated
with yaird would in no way justify the use of a potentially disastrous
function which nukes the user's entire system upon boot.

[ Compare my numbers from /proc/meminfo booting to single user mode...
[
[ without nuke_dir (two boots):
[   Active:          21152 kB
[   Active:          21164 kB
[
[ with nuke_dir (two boots):
[   Active:          16728 kB
[   Active:          16732 kB
[
[   # gzip -d < /boot/initrd.img-2.6.18-alcyone | cpio -t >/dev/null
[   10227 blocks
[
[

On the contrary, the initramfs-tools (not that I have ever been
employing them) seem to be happily nuking along by default; the
included init script calls run-init from klibc-utils, which in turn
invokes the run_init function from usr/kinit/run-init/runinitlib.c,
which nearly exactly resembles exec/run_init.c of yaird (with the only
notable exception of removing the die function).


I see no reasons why the code could not be trusted after nitpicking
examination. After all, deletion of rootfs seems to be advised by the
kernel author(s) of initramfs.

Could you reexamine the whole situation, and maybe consider enabling
the nuke_dir function in the long run?

Regards,
Peter


-- System Information:
Debian Release: testing/unstable
  APT prefers testing
  APT policy: (400, 'testing'), (50, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18-alcyone
Locale: LANG=C, LC_CTYPE=de_DE at euro (charmap=ISO-8859-15)

Versions of packages yaird depends on:
ii  cpio                         2.6-17      GNU cpio -- a program to manage ar
ii  dash                         0.5.3-3     The Debian Almquist Shell
ii  libc6                        2.3.6.ds1-4 GNU C Library: Shared libraries
ii  libhtml-template-perl        2.8-1       HTML::Template : A module for usin
ii  libparse-recdescent-perl     1.94.free-3 Generates recursive-descent parser
ii  perl                         5.8.8-6.1   Larry Wall's Practical Extraction 

yaird recommends no packages.

-- no debconf information




More information about the Yaird-devel mailing list