Opened 3 years ago

Closed 21 months ago

#63650 closed defect (fixed)

glib2: regression after update to 2.62 version with qemu tap-bridge networking

Reported by: andriytk (Andriy Tkachuk) Owned by: mascguy (Christopher Nielsen)
Priority: Normal Milestone:
Component: ports Version: 2.7.1
Keywords: Cc: ryandesign (Ryan Carsten Schmidt)
Port: glib2

Description (last modified by andriytk (Andriy Tkachuk))

After recent update from glib2 2.58.3_1 to 2.62.6_2 - QEMU tap-bridge networking stopped working: DHCP requests and replies from guest VM are seen on bridge0 interface, but on tap0 interface there are no replies (only the requests).

The problem was reported also here - https://forum.osdev.org/viewtopic.php?f=1&t=39828.

Tried with qemu-6.1 and 5.2 versions: in both cases it works fine with glib2 @2.58.3_1 (plus required libffi @3.3_1), and fails with glib2 @2.62.6_2 (plus required libffi @3.4.2_2).

As suggested at https://forum.osdev.org/viewtopic.php?p=316408&sid=427623ba50fe49f3c5267a45f83fb1da#p316408 the problem might be related to polling the device.

Also, I noticed that qemu process always consumes 100% CPU even when the quest VM is idle. (Which supports the idea about some problem with polling the device.) Again, this is not observed with the previous glibc2 version 2.58.3_1.

See more details here on how to reproduce the problem - https://gist.github.com/andriytk/bd3def8c30cbd474490280436c779027.

Change History (9)

comment:1 Changed 3 years ago by andriytk (Andriy Tkachuk)

Description: modified (diff)

comment:2 Changed 3 years ago by andriytk (Andriy Tkachuk)

Maybe we need to add something like this to meson.build for macOS too:

if host_system == 'windows'
  # Poll doesn't work on devices on Windows
  glib_conf.set('BROKEN_POLL', true)
endif

https://gitlab.gnome.org/GNOME/glib/-/blob/85969ce3dac5095d6bcdea5fa662220d01474f3c/meson.build#L151-154

Apparently, in the old version with configure.ac - the broken poll was detected automatically:

AC_MSG_CHECKING([for broken poll])
AC_RUN_IFELSE([AC_LANG_SOURCE([[
	#include <stdlib.h>
	#include <fcntl.h>
	#include <poll.h>
	int main(void) {
	  struct pollfd fds[1];
	  int fd;
	  fd = open("/dev/null", 1);
	  fds[0].fd = fd;
	  fds[0].events = POLLIN;
	  fds[0].revents = 0;
	  if (poll(fds, 1, 0) < 0 || (fds[0].revents & POLLNVAL) != 0) {
		exit(1);  /* Does not work for devices -- fail */
	  }
	  exit(0);
	}]])],
  [broken_poll=no],
  [broken_poll=yes
   AC_DEFINE(BROKEN_POLL,1,[poll doesn't work on devices])],
  [broken_poll="no (cross compiling)"])
AC_MSG_RESULT($broken_poll)

https://gitlab.gnome.org/GNOME/glib/-/blob/d80d9af9b7f1fdd25e61ae04fb660e65bf5bb5fc/configure.ac#L2353-2374

But in the new version, after they switched to meson.build - this does not work anymore, I'm afraid.

comment:3 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)

Keywords: qemu tap bridge networking regression removed
Port: glib2 added; glibc2 removed

comment:4 Changed 3 years ago by mascguy (Christopher Nielsen)

Cc: mascguy added

comment:5 Changed 21 months ago by mascguy (Christopher Nielsen)

Cc: ryandesign added; mascguy removed
Owner: set to mascguy
Status: newassigned
Summary: Regression in glib2 after update to 2.62 version with qemu tap-bridge networkingglib2: regression after update to 2.62 version with qemu tap-bridge networking

comment:6 Changed 21 months ago by mascguy (Christopher Nielsen)

It looks like the fix is included in upstream releases, starting with 2.72.1. So glib2-upstream is fine.

But I'll patch glib2 and glib2-devel. Thanks for the heads-up!

comment:7 Changed 21 months ago by Christopher Nielsen <mascguy@…>

In a80002d2c6244354552d3414abcf60164e0b0a1d/macports-ports (master):

glib2-devel: patch for broken poll()
See: #63650

comment:8 Changed 21 months ago by Christopher Nielsen <mascguy@…>

In 6793fba36e92f558353e4ae068e3ece89649747e/macports-ports (master):

glib2: patch for broken poll()
See: #63650

comment:9 Changed 21 months ago by mascguy (Christopher Nielsen)

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.