Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 1893892 - enabling LTO build causes: qemu-system-arm: /builddir/build/BUILD/qemu-5.1.0/exec.c:1458: phys_section_add: Assertion `map->sections_nb < TARGET_PAGE_SIZE' failed.
Summary: enabling LTO build causes: qemu-system-arm: /builddir/build/BUILD/qemu-5.1.0/...
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: qemu
Version: 34
Hardware: armv7hl
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Fedora Virtualization Maintainers
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: ARMTracker TRACKER-bugs-affecting-libguestfs
TreeView+ depends on / blocked
 
Reported: 2020-11-02 22:03 UTC by Richard W.M. Jones
Modified: 2021-02-09 15:22 UTC (History)
10 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Richard W.M. Jones 2020-11-02 22:03:50 UTC
Description of problem:

qemu-system-arm cannot boot the current kernel.  It immediately
exits with:

qemu-system-arm: /builddir/build/BUILD/qemu-5.1.0/exec.c:1458: phys_section_add: Assertion `map->sections_nb < TARGET_PAGE_SIZE' failed.

Version-Release number of selected component (if applicable):

qemu 2:5.1.0-6.fc34
kernel 5.10.0-0.rc1.20201028gited8780e3f2ec.57.fc34.armv7hl

How reproducible:

At least once.

Steps to Reproduce:
1. Run qemu-sanity-check or libguestfs-test-tool.

Additional info:

Full log: https://kojipkgs.fedoraproject.org//work/tasks/8637/54798637/build.log

Comment 1 Richard W.M. Jones 2020-11-02 22:06:13 UTC
Full output:

/usr/bin/qemu-system-arm \
    -global virtio-blk-device.scsi=off \
    -no-user-config \
    -enable-fips \
    -nodefaults \
    -display none \
    -machine virt,accel=kvm:tcg \
    -cpu host \
    -m 1280 \
    -no-reboot \
    -rtc driftfix=slew \
    -kernel /var/tmp/.guestfs-1000/appliance.d/kernel \
    -initrd /var/tmp/.guestfs-1000/appliance.d/initrd \
    -object rng-random,filename=/dev/urandom,id=rng0 \
    -device virtio-rng-device,rng=rng0 \
    -device virtio-scsi-device,id=scsi \
    -drive file=nbd:unix:/tmp/nbdkitgtoKeO/socket,cache=writeback,id=hd0,if=none \
    -device scsi-hd,drive=hd0 \
    -drive file=/var/tmp/.guestfs-1000/appliance.d/root,snapshot=on,id=appliance,cache=unsafe,if=none,format=raw \
    -device scsi-hd,drive=appliance \
    -device virtio-serial-device \
    -serial stdio \
    -chardev socket,path=/tmp/libguestfs281W3m/guestfsd.sock,id=channel0 \
    -device virtserialport,chardev=channel0,name=org.libguestfs.channel.0 \
    -append "panic=1 mem=1280M console=ttyAMA0 edd=off udevtimeout=6000 udev.event-timeout=6000 no_timer_check printk.time=1 cgroup_disable=memory usbcore.nousb cryptomgr.notests tsc=reliable 8250.nr_uarts=1 root=UUID=814dcbd6-ef9e-4e9e-9566-36f8bf5d4333 selinux=0 guestfs_verbose=1 TERM=vt100"
qemu-system-arm: /builddir/build/BUILD/qemu-5.1.0/exec.c:1458: phys_section_add: Assertion `map->sections_nb < TARGET_PAGE_SIZE' failed.

Comment 2 Richard W.M. Jones 2020-11-02 22:20:12 UTC
Bug also happens on aarch64:

/usr/bin/qemu-system-aarch64 \
    -global virtio-blk-pci.scsi=off \
    -no-user-config \
    -enable-fips \
    -nodefaults \
    -display none \
    -machine virt,gic-version=host,accel=kvm:tcg \
    -cpu host \
    -m 1280 \
    -no-reboot \
    -rtc driftfix=slew \
    -drive if=pflash,format=raw,file=/usr/share/AAVMF/AAVMF_CODE.fd,readonly \
    -drive if=pflash,format=raw,file=/tmp/libguestfs443tL1/vars3.fd \
    -kernel /var/tmp/.guestfs-1000/appliance.d/kernel \
    -initrd /var/tmp/.guestfs-1000/appliance.d/initrd \
    -object rng-random,filename=/dev/urandom,id=rng0 \
    -device virtio-rng-pci,rng=rng0 \
    -device virtio-scsi-pci,id=scsi \
    -drive file=nbd:unix:/tmp/nbdkitMaPlbS/socket,cache=writeback,id=hd0,if=none \
    -device scsi-hd,drive=hd0 \
    -drive file=/var/tmp/.guestfs-1000/appliance.d/root,snapshot=on,id=appliance,cache=unsafe,if=none,format=raw \
    -device scsi-hd,drive=appliance \
    -device virtio-serial-pci \
    -serial stdio \
    -chardev socket,path=/tmp/libguestfsWTWpz4/guestfsd.sock,id=channel0 \
    -device virtserialport,chardev=channel0,name=org.libguestfs.channel.0 \
    -append "panic=1 console=ttyAMA0 earlyprintk=pl011,,0x9000000 ignore_loglevel efi-rtc=noprobe edd=off udevtimeout=6000 udev.event-timeout=6000 no_timer_check printk.time=1 cgroup_disable=memory usbcore.nousb cryptomgr.notests tsc=reliable 8250.nr_uarts=1 root=UUID=f8570e82-5b99-48bb-b52e-74587d187cc5 selinux=0 guestfs_verbose=1 TERM=vt100"
qemu-system-aarch64: /builddir/build/BUILD/qemu-5.1.0/exec.c:1458: phys_section_add: Assertion `map->sections_nb < TARGET_PAGE_SIZE' failed.

Comment 3 Richard W.M. Jones 2020-11-03 11:02:13 UTC
This is the shortest reproducer I could make:

$ qemu-system-aarch64 -machine virt,accel=kvm:tcg -m 1280 
qemu-system-aarch64: /builddir/build/BUILD/qemu-5.1.0/exec.c:1458: phys_section_add: Assertion `map->sections_nb < TARGET_PAGE_SIZE' failed.

For unclear reasons it only crashes with qemu from Fedora Rawhide, not
with qemu that I built myself from git.

Stack trace from the assert fail:

#0  0x0000ffff9bc68630 in raise () at /lib64/libc.so.6
#1  0x0000ffff9bc5481c in abort () at /lib64/libc.so.6
#2  0x0000ffff9bc6176c in __assert_fail_base () at /lib64/libc.so.6
#3  0x0000ffff9bc617d4 in annobin_assert.c_end () at /lib64/libc.so.6
#4  0x0000aaaab3b6ac50 in phys_section_add
    (map=<optimized out>, section=section@entry=0xffffe0c48fc0)
    at /usr/src/debug/qemu-5.1.0-6.fc34.aarch64/exec.c:1458
#5  0x0000aaaab3b6bb2c in dummy_section
    (mr=0xaaaab4879d10 <io_mem_unassigned>, fv=0xaaaaef383d00, map=<optimized out>) at /usr/src/debug/qemu-5.1.0-6.fc34.aarch64/exec.c:2931
#6  address_space_dispatch_new (fv=0xaaaaef383d00)
    at /usr/src/debug/qemu-5.1.0-6.fc34.aarch64/exec.c:2931
#7  0x0000aaaab3cf7514 in generate_memory_topology (mr=mr@entry=0x0)
    at /usr/src/debug/qemu-5.1.0-6.fc34.aarch64/softmmu/memory.c:717
#8  0x0000aaaab3cf780c in flatviews_init ()
    at /usr/src/debug/qemu-5.1.0-6.fc34.aarch64/softmmu/memory.c:970
#9  flatviews_init ()
    at /usr/src/debug/qemu-5.1.0-6.fc34.aarch64/softmmu/memory.c:959
#10 0x0000aaaab3cf7b08 in address_space_update_topology
    (as=0xaaaab4879eb8 <address_space_memory>)
    at /usr/src/debug/qemu-5.1.0-6.fc34.aarch64/softmmu/memory.c:1050
#11 address_space_init
    (as=0xaaaab4879eb8 <address_space_memory>, root=<optimized out>, name=0xaaaab436e220 "memory")
    at /usr/src/debug/qemu-5.1.0-6.fc34.aarch64/softmmu/memory.c:2772
#12 0x0000aaaab3b6eb60 in memory_map_init ()
    at /usr/src/debug/qemu-5.1.0-6.fc34.aarch64/exec.c:3007
#13 cpu_exec_init_all ()
    at /usr/src/debug/qemu-5.1.0-6.fc34.aarch64/exec.c:3463
#14 0x0000aaaab3d068a0 in qemu_init
    (argc=<optimized out>, argv=<optimized out>, envp=<optimized out>)
    at /usr/src/debug/qemu-5.1.0-6.fc34.aarch64/softmmu/vl.c:3901
#15 0x0000aaaab3b67a50 in main
    (argc=<optimized out>, argv=<optimized out>, envp=<optimized out>)
    at /usr/src/debug/qemu-5.1.0-6.fc34.aarch64/softmmu/main.c:48

Comment 4 Richard W.M. Jones 2020-11-04 15:24:20 UTC
This is caused by enabling LTO.

Comment 5 Richard W.M. Jones 2020-12-12 18:11:19 UTC
While this is fixed in qemu-5.1.0-8.fc33.aarch64 I'm not sure
if we want to close this bug yet.  The bug was caused by LTO,
and to "fix" it we just turned LTO off.

Comment 6 Ben Cotton 2021-02-09 15:22:57 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 34 development cycle.
Changing version to 34.


Note You need to log in before you can comment on or make changes to this bug.