Re: Qemu with E1000 NIC causing segfault when compiled statically in Docker

2023-07-11 Thread Peter Maydell
On Tue, 11 Jul 2023 at 15:18, Weller, Nitzan  wrote:
>
> Hello,
>
> We are trying to run Qemu with E1000 as the NIC.
> The Qemu we use is compiled statically using a Docker, based on 
> https://github.com/ziglang/qemu-static.
> When we boot a VM it causes a Segfault that crashes the VM during the boot 
> process, before reaching the prompt.
> The Core dump indicated there is an issue in libslirp.
> A few things we tried:
>
> Compiling locally - Running a VM using static Qemu that we compiled locally 
> on a computer doesn't cause the Segfault.
> Updating the version of Qemu or libslirp - Didn't change the outcome.
> Different NIC - Using virtio instead of E1000 doesn't cause a Segfault, but 
> we need E1000.
>
> Do you have an idea what might cause this issue or how to proceed in 
> investigating it?

If I understand your bug report right then you have:
 * build QEMU locally, no segfault
 * build identical QEMU in docker, segfaults
?

In that case you should try to narrow down exactly what
the differences are between the two build environments
(what dependent libraries are present, what configure
options passed to QEMU, what compiler version, etc),
because presumably one of those differences is affecting
the outcome.

The other thing that would be useful here is if you can
build both (the latest versions of) QEMU and libslirp with
debugging enabled and reproduce the backtrace -- optimization
has removed most of the useful clues from the backtrace you
list here, unfortunately.

thanks
-- PMM



Qemu with E1000 NIC causing segfault when compiled statically in Docker

2023-07-11 Thread Weller, Nitzan
Hello,

We are trying to run Qemu with E1000 as the NIC.
The Qemu we use is compiled statically using a Docker, based on 
https://github.com/ziglang/qemu-static.
When we boot a VM it causes a Segfault that crashes the VM during the boot 
process, before reaching the prompt.
The Core dump indicated there is an issue in libslirp.
A few things we tried:

  1.
Compiling locally - Running a VM using static Qemu that we compiled locally on 
a computer doesn't cause the Segfault.
  2.  Updating the version of Qemu or libslirp - Didn't change the outcome.
  3.  Different NIC - Using virtio instead of E1000 doesn't cause a Segfault, 
but we need E1000.

Do you have an idea what might cause this issue or how to proceed in 
investigating it?

Regards,
Nitzan


Here is the trace we got from the core dump:

Thread 4 "qemu-system-aar" received signal SIGSEGV, Segmentation fault.
[Switching to LWP 50999]
0x7f902a83222e in if_encap ()
(gdb) bt
#0 0x71902a83222e in if_encap ()
#1 0x7f902a844360 in ip6 output ()
#2 0x71902a84347f in ndp_send_ns ()
#3 0x71902a8321ae in if encap6 ()
#4 0x71902a832307 in if encap ()
#5 0x71902a84249f in if_start()
#6 0x7f902a842333 in if output ()
#7 0x7f902a844375 in ip6 output ()
#8 0x7f902a842e31 in icmp6_send_error ()
#9 0x7f902a83e2cc in udp6_input ()
#10 0x71902a84421a in ip6_input ()
#11 0x7f902a831ec1 in slirp_input ()
#12 0x7f902a127681 in net slirp_receive (nc=, buf=, size=110) at ../../src/qemu-7.2.0/net/slirp.c:136
#13 0x7f902a11f6ld in nc_sendv_compat (flags=, iovcnt=1, 
iov=0x7f8ce0bfddb0, nc=0x7f9029622c30) at ../../src/qemu-7.2.0/net/net.c:776
#14 qemu_deliver_packet_iov (sender=, opaque=0x7f9029622c30, 
iovcnt=1, iov=0x7f8ce0bfddbo, flags=) at 
../../src/qemu-7.2.0/net/net.c:804
#15 qemu deliver packet iov (sender=, flags=, 
iov=0x7f8ce0bfddb0, iovcnt=1, opaque=0x7f9029622c30) at 
../../src/qemu-7.2.0/net/net.c:783
#16 in qemu_net_queue_deliver (size=110, data=0x7f8ce0841ea0 "RV", flags=0, 
sender=0x7f8fe925da80, queue=0x7f902960c220) at 
../../src/qemu-7.2.0/net/queue.c:164
#17 qemu_net_queue_send (queue=0x7f902960c220, sender=0x7f8fe925da80, 
flags-flags@entry=0, data-data@entry=0x7f8ce0841ea0 "RV", size=110, 
sent_cb-sent_cb@entry=0x0) at ./../src/qemu-7.2.0/net/queue.c:221
#18 in qemu_send_packet_async_with_flags (sender=, 
flags-flags@entry=0, buf=0x7f8ce0841ea0 "RV", size=, 
sent_cb=sent_cb@entry=0x0) at ../../src/qemu-7.2.0/net/net.c:711
#19 0x7f902a120f5d in qemu_send_packet_async_with_flags (sent_cb=0x0, 
size=, buf=, flags=0, sender=) at 
../../src/qemu-7.2.0/net/net.c:718
#20 qemu_send_packet_async (sent_cb=0x0, size=, buf=, sender=) at ../../src/qemu-7.2.0/net/net.c:718
#21 qemu_send_packet (nc=, buf=, size=) at ../../src/qemu-7.2.0/net/net.c:724