User mode networking not working properly on QEMU on Mac OS X host

Bug #1916344 reported by Ven Karri
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
QEMU
Expired
Undecided
Unassigned

Bug Description

Steps to reproduce:

1. Install QEMU using homebrew on Mac OS X (I tried on Catalina and Big Sur)
2. Spin up a guest VM (say) Cent OS 8 using user mode networking.
3. Install podman inside the guest
4. Run podman pull alpine

The result is:

[root@localhost ~]# podman pull alpine
Resolved "alpine" as an alias (/etc/containers/registries.conf.d/shortnames.conf)
Trying to pull docker.io/library/alpine:latest...
Getting image source signatures
Copying blob ba3557a56b15 [======================================] 2.7MiB / 2.7MiB
  unexpected EOF
Error: Error writing blob: error storing blob to file "/var/tmp/storage851171596/1": error happened during read: unexpected EOF

This is happening because QEMU is telling the guest that the TCP connection is closed even before reading all the data from the host socket and forwarding it to the guest.

This issue doesn't happen on a Linux host. So, that tells me that this has something to do with QEMU installation on Mac OS X.

This could be a slirp related issue. So, QEMU/slirp may need to work together on fixing this. Here's the link to the libslirp issue:

https://gitlab.freedesktop.org/slirp/libslirp/-/issues/35

Ven Karri (imperialguy)
information type: Private Security → Public
Ven Karri (imperialguy)
description: updated
Ven Karri (imperialguy)
description: updated
tags: added: libslirp
Ven Karri (imperialguy)
description: updated
Revision history for this message
John Arbuckle (programmingkidx) wrote :

I built QEMU from the git repo. My Windows XP and Mac OS 10.4 guests cannot access the internet. I'm on a M1 Mac running Mac OS 11.1. I use qemu-system-i386 and qemu-system-ppc.

I tried installing slirp from MacPorts but it is broken. It might have been broken for years. See https://trac.macports.org/ticket/41875. So slirp networking probably isn't going to work.

Revision history for this message
Ven Karri (imperialguy) wrote :

I am not sure if a separate slirp installation via macports is necessary. When you install qemu via homebrew, it's supposed to install any slirp related libarries as part of qemu installation. Having said that, I haven't noticed a slirp package installed on my mac when I did a `brew list`.

So, I don't know how exactly is qemu packing slirp libraries within itself while installing on a mac. I think there's some kinda git option during installation. Perhaps brew uses that.

Revision history for this message
Thomas Huth (th-huth) wrote :
Revision history for this message
Ven Karri (imperialguy) wrote :

Yes, I think it's the same issue. So, are you planning to integrate the following patch into the source code?

https://bugs.launchpad.net/qemu/+bug/1914117/comments/10

Or is there a better solution you are working on?

Revision history for this message
John Arbuckle (programmingkidx) wrote :

I'm on Mac OS 11.1 on an M1 Mac. I did some tests with QEMU 2.10.1 and 5.3 and here are the results:

QEMU 2.10.1:
- Ran Windows XP as a guest
- qemu-system-i386 -m 700 -hda <Windows XP HD file> -netdev user,id=n0 -device rtl8139,netdev=n0
- Internet Explorer was able to load a web page.

QEMU 5.3.x:
- Tried to run Windows XP as a guest:
- qemu-system-i386 -m 700 -hda <Windows XP HD file> -netdev user,id=n0 -device rtl8139,netdev=n0
- QEMU refused to run and displayed this error message: qemu-system-i386: -netdev user,id=n0: Parameter 'type' expects a netdev backend type

I'm not sure if this message is a bug or something else.

Revision history for this message
Adam Chappell (adamchappell) wrote :

Different problem here I think John. If you run the following you should the user mode networking that involves Slirp and has the problem.

```
 qemu-system-i386 -m 700 -hda <Windows XP HD file> -net user -net nic
```

It's worth noting however that the problem most regularly manifest itself when a remote server delivers content and THEN closes the TCP socket straight away. When this happens, the return from the Mac's poll() system call seems to tickle Slirp's TCP urgent code, which results in the guest breaking up the received payload, mistakenly believing some of it to be "urgent". (I've no clue if Windows XP supports something SO_OOBINLINE that might alleviate the problem...)

If you use HTTP/1.1, you might not see this if the HTTP client is using a persistent connection, because the server will not close immediately after transmitting. Not sure what podman does in the opening comment above, and not sure what IE's default mode of operation is either.

If you're looking for a fix, there is Chris's patch in https://bugs.launchpad.net/qemu/+bug/1914117

Thomas Huth (th-huth)
tags: removed: qemu
Revision history for this message
Thomas Huth (th-huth) wrote :

The QEMU project is currently moving its bug tracking to another system.
For this we need to know which bugs are still valid and which could be
closed already. Thus we are setting the bug state to "Incomplete" now.

If the bug has already been fixed in the latest upstream version of QEMU,
then please close this ticket as "Fix released".

If it is not fixed yet and you think that this bug report here is still
valid, then you have two options:

1) If you already have an account on gitlab.com, please open a new ticket
for this problem in our new tracker here:

    https://gitlab.com/qemu-project/qemu/-/issues

and then close this ticket here on Launchpad (or let it expire auto-
matically after 60 days). Please mention the URL of this bug ticket on
Launchpad in the new ticket on GitLab.

2) If you don't have an account on gitlab.com and don't intend to get
one, but still would like to keep this ticket opened, then please switch
the state back to "New" or "Confirmed" within the next 60 days (other-
wise it will get closed as "Expired"). We will then eventually migrate
the ticket automatically to the new system (but you won't be the reporter
of the bug in the new system and thus you won't get notified on changes
anymore).

Thank you and sorry for the inconvenience.

Changed in qemu:
status: New → Incomplete
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for QEMU because there has been no activity for 60 days.]

Changed in qemu:
status: Incomplete → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.