Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 Mar 2021 00:06:43 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 254649] 12.2-RELEASE: possible memory overrun in the loader(8)
Message-ID:  <bug-254649-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D254649

            Bug ID: 254649
           Summary: 12.2-RELEASE: possible memory overrun in the loader(8)
           Product: Base System
           Version: 12.2-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: eugen@freebsd.org
                CC: imp@FreeBSD.org, kevans@freebsd.org,
                    tsoome@freebsd.org

Hi!

I've found that adding loading of several kernel modules to /boot/loader.co=
nf
can result in failure to mount ZFS root file system at boot time and going =
to=20
mountroot> prompt.

I've faced to problem after successfully installing and running FreeBSD
12.2/amd64 as VM guest at some hoster providing cheap 1GB RAM/20GB HDD plan.
I've reproduced the problem using my own VirtualBox.

How to repeat:

Use any hypervisor to create new VM for FreeBSD 12.2-RELEASE/amd64 with 102=
4MB
RAM and 20GB HDD (thin provisioning is OK, network is not required nor used=
).
Attach official FreeBSD-12.2-RELEASE-amd64-disc1.iso image to virtual CD and
boot it. Do not use bsdinstall installation procedures but enter Shell dire=
ctly
to perform installation this way (maybe replace ada0 with da0 or vtbd0
depending on hypervisor):

# make MBR with two slices, first one for swap (2GB), the rest for ZFS boot
pool
gpart destroy -F ada0
gpart create -s MBR ada0
gpart add -b 504 -t freebsd -s 2g ada0
glabel label swap ada0s1
gpart add -t freebsd ada0

# install bootloaders according to zfsboot(8) manual page
gpart bootcode -b /boot/boot0 ada0
gpart set -a active -i 2 ada0
boot0cfg -s 2 ada0
dd if=3D/dev/zero of=3D/dev/ada0s2 count=3D2
dd if=3D/boot/zfsboot of=3D/dev/ada0s2 count=3D1
dd if=3D/boot/zfsboot of=3D/dev/ada0s2 iseek=3D1 oseek=3D1024

# create and populate ZFS boot pool named "os"
zpool create -f -O reservation=3D100m -O compression=3Dlz4 -O atime=3Doff -=
m / -R
/mnt os /dev/ada0s2
cd /mnt
tar xf /usr/freebsd-dist/kernel.txz
tar xf /usr/freebsd-dist/base.txz

cat > boot/loader.conf <<EOF
kern.vty=3Dsc
beastie_disable=3D"YES"
autoboot_delay=3D"6"
hw.memtest.tests=3D0
zfs_load=3D"YES"
vfs.root.mountfrom=3D"zfs:os"
dumpdev=3D"/dev/label/swap"
EOF

cat > etc/rc.conf <<EOF
hostname=3D"test.localdomain"
zfs_enable=3D"YES"
EOF

cat > etc/fstab <<EOF
# Device        Mountpoint      FStype  Options         Dump    Pass#
/dev/label/swap none            swap    sw              0       0
EOF

cd /
umount -f /mnt
zpool export os
halt -p

Now the system is ready to boot off emulated HDD. Reconfigure the VM to boot
off HDD instead of CD and boot it. It should boot to multiuser just fine.

Now add 4 lines to /boot/loader.conf:

aesni_load=3D"YES"
mac_portacl_load=3D"YES"
dummynet_load=3D"YES"
libalias_load=3D"YES"

Reboot the VM and see the failure:

Mounting from zfs:os failed with error 5; retrying for more 3 seconds
Mounting from zfs:os failed with error 5.
...
mountroot>

To recover, one needs to escape to loader prompt at boot time and use "unlo=
ad"
command then manually load kernel, opensolaris.ko and zfs.ko then proceed w=
ith
booting.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-254649-227>