All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [Bug 1823790] [NEW] QEMU forces systemd into tight loop
@ 2019-04-08 20:34 Matthias Lüscher
  2019-04-09 13:14 ` [Qemu-devel] [Bug 1823790] " Peter Maydell
                   ` (22 more replies)
  0 siblings, 23 replies; 25+ messages in thread
From: Matthias Lüscher @ 2019-04-08 20:34 UTC (permalink / raw)
  To: qemu-devel

Public bug reported:

While building Debian images for embedded ARM target systems I detected
that QEMU seems to force newer systemd daemons into a tight loop.

My setup is the following:

Host machine: Ubuntu 18.04, amd64
LXD container: Debian Buster, arm64, systemd 241
QEMU: qemu-aarch64-static, 4.0.0-rc2 (custom build) and 3.1.0 (Debian 1:3.1+dfsg-7)

To easily reproduce the issue I have created the following repository:
https://github.com/lueschem/edi-qemu

The call where systemd gets looping is the following:
2837 getsockopt(3,1,31,274891889456,274887218756,274888927920) = -1 errno=34 (Numerical result out of range)

Furthermore I also verified that the issue is not related to LXD.
The same behavior can be reproduced using systemd-nspawn.

This issue reported against systemd seems to be related:
https://github.com/systemd/systemd/issues/11557

** Affects: qemu
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1823790

Title:
  QEMU forces systemd into tight loop

Status in QEMU:
  New

Bug description:
  While building Debian images for embedded ARM target systems I
  detected that QEMU seems to force newer systemd daemons into a tight
  loop.

  My setup is the following:

  Host machine: Ubuntu 18.04, amd64
  LXD container: Debian Buster, arm64, systemd 241
  QEMU: qemu-aarch64-static, 4.0.0-rc2 (custom build) and 3.1.0 (Debian 1:3.1+dfsg-7)

  To easily reproduce the issue I have created the following repository:
  https://github.com/lueschem/edi-qemu

  The call where systemd gets looping is the following:
  2837 getsockopt(3,1,31,274891889456,274887218756,274888927920) = -1 errno=34 (Numerical result out of range)

  Furthermore I also verified that the issue is not related to LXD.
  The same behavior can be reproduced using systemd-nspawn.

  This issue reported against systemd seems to be related:
  https://github.com/systemd/systemd/issues/11557

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1823790/+subscriptions

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Qemu-devel] [Bug 1823790] Re: QEMU forces systemd into tight loop
  2019-04-08 20:34 [Qemu-devel] [Bug 1823790] [NEW] QEMU forces systemd into tight loop Matthias Lüscher
@ 2019-04-09 13:14 ` Peter Maydell
  2019-04-09 13:26 ` [Qemu-devel] [Bug 1823790] Re: QEMU mishandling of SO_PEERSEC " Peter Maydell
                   ` (21 subsequent siblings)
  22 siblings, 0 replies; 25+ messages in thread
From: Peter Maydell @ 2019-04-09 13:14 UTC (permalink / raw)
  To: qemu-devel

** Tags added: linux-user

** Tags added: arm

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1823790

Title:
  QEMU forces systemd into tight loop

Status in QEMU:
  New

Bug description:
  While building Debian images for embedded ARM target systems I
  detected that QEMU seems to force newer systemd daemons into a tight
  loop.

  My setup is the following:

  Host machine: Ubuntu 18.04, amd64
  LXD container: Debian Buster, arm64, systemd 241
  QEMU: qemu-aarch64-static, 4.0.0-rc2 (custom build) and 3.1.0 (Debian 1:3.1+dfsg-7)

  To easily reproduce the issue I have created the following repository:
  https://github.com/lueschem/edi-qemu

  The call where systemd gets looping is the following:
  2837 getsockopt(3,1,31,274891889456,274887218756,274888927920) = -1 errno=34 (Numerical result out of range)

  Furthermore I also verified that the issue is not related to LXD.
  The same behavior can be reproduced using systemd-nspawn.

  This issue reported against systemd seems to be related:
  https://github.com/systemd/systemd/issues/11557

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1823790/+subscriptions

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Qemu-devel] [Bug 1823790] Re: QEMU mishandling of SO_PEERSEC forces systemd into tight loop
  2019-04-08 20:34 [Qemu-devel] [Bug 1823790] [NEW] QEMU forces systemd into tight loop Matthias Lüscher
  2019-04-09 13:14 ` [Qemu-devel] [Bug 1823790] " Peter Maydell
@ 2019-04-09 13:26 ` Peter Maydell
  2019-04-11 20:36 ` Matthias Lüscher
                   ` (20 subsequent siblings)
  22 siblings, 0 replies; 25+ messages in thread
From: Peter Maydell @ 2019-04-09 13:26 UTC (permalink / raw)
  To: qemu-devel

As described on the systemd issue, the syscall we're getting wrong here
is getsockopt(fd, SOL_SOCKET, SO_PEERSEC, ...). Our linux-
user/syscall.c:do_getsockopt() doesn't have any special case code for
the payload on this function, so we treat it as if it were just an
integer payload, which is not correct here.

Unfortunately I can't find any documentation on exactly what SO_PEERSEC
does or what the payload format is, which makes it pretty hard to fix
this bug :-( It's not listed in the socket(7) manpage --
https://linux.die.net/man/7/socket -- which is where I'd expect to find
it, and the kernel source code is pretty confusing in this area.


** Summary changed:

- QEMU forces systemd into tight loop
+ QEMU mishandling of SO_PEERSEC forces systemd into tight loop

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1823790

Title:
  QEMU mishandling of SO_PEERSEC forces systemd into tight loop

Status in QEMU:
  New

Bug description:
  While building Debian images for embedded ARM target systems I
  detected that QEMU seems to force newer systemd daemons into a tight
  loop.

  My setup is the following:

  Host machine: Ubuntu 18.04, amd64
  LXD container: Debian Buster, arm64, systemd 241
  QEMU: qemu-aarch64-static, 4.0.0-rc2 (custom build) and 3.1.0 (Debian 1:3.1+dfsg-7)

  To easily reproduce the issue I have created the following repository:
  https://github.com/lueschem/edi-qemu

  The call where systemd gets looping is the following:
  2837 getsockopt(3,1,31,274891889456,274887218756,274888927920) = -1 errno=34 (Numerical result out of range)

  Furthermore I also verified that the issue is not related to LXD.
  The same behavior can be reproduced using systemd-nspawn.

  This issue reported against systemd seems to be related:
  https://github.com/systemd/systemd/issues/11557

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1823790/+subscriptions

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Qemu-devel] [Bug 1823790] Re: QEMU mishandling of SO_PEERSEC forces systemd into tight loop
  2019-04-08 20:34 [Qemu-devel] [Bug 1823790] [NEW] QEMU forces systemd into tight loop Matthias Lüscher
  2019-04-09 13:14 ` [Qemu-devel] [Bug 1823790] " Peter Maydell
  2019-04-09 13:26 ` [Qemu-devel] [Bug 1823790] Re: QEMU mishandling of SO_PEERSEC " Peter Maydell
@ 2019-04-11 20:36 ` Matthias Lüscher
  2019-04-11 20:52 ` Matthias Lüscher
                   ` (19 subsequent siblings)
  22 siblings, 0 replies; 25+ messages in thread
From: Matthias Lüscher @ 2019-04-11 20:36 UTC (permalink / raw)
  To: qemu-devel

This is probably the tight loop that gets triggered:
https://github.com/systemd/systemd/commit/217d89678269334f461e9abeeffed57077b21454

It looks like the previous implementation was just a bit more
"tolerant".

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1823790

Title:
  QEMU mishandling of SO_PEERSEC forces systemd into tight loop

Status in QEMU:
  New

Bug description:
  While building Debian images for embedded ARM target systems I
  detected that QEMU seems to force newer systemd daemons into a tight
  loop.

  My setup is the following:

  Host machine: Ubuntu 18.04, amd64
  LXD container: Debian Buster, arm64, systemd 241
  QEMU: qemu-aarch64-static, 4.0.0-rc2 (custom build) and 3.1.0 (Debian 1:3.1+dfsg-7)

  To easily reproduce the issue I have created the following repository:
  https://github.com/lueschem/edi-qemu

  The call where systemd gets looping is the following:
  2837 getsockopt(3,1,31,274891889456,274887218756,274888927920) = -1 errno=34 (Numerical result out of range)

  Furthermore I also verified that the issue is not related to LXD.
  The same behavior can be reproduced using systemd-nspawn.

  This issue reported against systemd seems to be related:
  https://github.com/systemd/systemd/issues/11557

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1823790/+subscriptions

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Qemu-devel] [Bug 1823790] Re: QEMU mishandling of SO_PEERSEC forces systemd into tight loop
  2019-04-08 20:34 [Qemu-devel] [Bug 1823790] [NEW] QEMU forces systemd into tight loop Matthias Lüscher
                   ` (2 preceding siblings ...)
  2019-04-11 20:36 ` Matthias Lüscher
@ 2019-04-11 20:52 ` Matthias Lüscher
  2019-08-16  6:46 ` Fritz Katze
                   ` (18 subsequent siblings)
  22 siblings, 0 replies; 25+ messages in thread
From: Matthias Lüscher @ 2019-04-11 20:52 UTC (permalink / raw)
  To: qemu-devel

I have just studied a bit the systemd code and this brought me to the
following idea/temporary workaround: What about returning -1 (error) and
setting errno when getsockopt(fd, SOL_SOCKET, SO_PEERSEC, ...) gets
called? This would then let systemd know that SO_PEERSEC is not (yet)
implemented.

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1823790

Title:
  QEMU mishandling of SO_PEERSEC forces systemd into tight loop

Status in QEMU:
  New

Bug description:
  While building Debian images for embedded ARM target systems I
  detected that QEMU seems to force newer systemd daemons into a tight
  loop.

  My setup is the following:

  Host machine: Ubuntu 18.04, amd64
  LXD container: Debian Buster, arm64, systemd 241
  QEMU: qemu-aarch64-static, 4.0.0-rc2 (custom build) and 3.1.0 (Debian 1:3.1+dfsg-7)

  To easily reproduce the issue I have created the following repository:
  https://github.com/lueschem/edi-qemu

  The call where systemd gets looping is the following:
  2837 getsockopt(3,1,31,274891889456,274887218756,274888927920) = -1 errno=34 (Numerical result out of range)

  Furthermore I also verified that the issue is not related to LXD.
  The same behavior can be reproduced using systemd-nspawn.

  This issue reported against systemd seems to be related:
  https://github.com/systemd/systemd/issues/11557

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1823790/+subscriptions

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Qemu-devel] [Bug 1823790] Re: QEMU mishandling of SO_PEERSEC forces systemd into tight loop
  2019-04-08 20:34 [Qemu-devel] [Bug 1823790] [NEW] QEMU forces systemd into tight loop Matthias Lüscher
                   ` (3 preceding siblings ...)
  2019-04-11 20:52 ` Matthias Lüscher
@ 2019-08-16  6:46 ` Fritz Katze
  2019-08-16  9:05 ` Fritz Katze
                   ` (17 subsequent siblings)
  22 siblings, 0 replies; 25+ messages in thread
From: Fritz Katze @ 2019-08-16  6:46 UTC (permalink / raw)
  To: qemu-devel

I filed the duplicate #1840252 of this bug.

I think that the options SO_PEERCRED and SO_PEERSEC belong into the
context of SELINUX. So maybe the format of the paylod can be found in
the sources of libselinux?

I'd like to compile qemu with a local hack to work around my current
problem. Something like Matthias Lüscher suggested.

@Peter Maydell: could you point me to the location in the qemu source
where I could apply such a hack?

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1823790

Title:
  QEMU mishandling of SO_PEERSEC forces systemd into tight loop

Status in QEMU:
  New

Bug description:
  While building Debian images for embedded ARM target systems I
  detected that QEMU seems to force newer systemd daemons into a tight
  loop.

  My setup is the following:

  Host machine: Ubuntu 18.04, amd64
  LXD container: Debian Buster, arm64, systemd 241
  QEMU: qemu-aarch64-static, 4.0.0-rc2 (custom build) and 3.1.0 (Debian 1:3.1+dfsg-7)

  To easily reproduce the issue I have created the following repository:
  https://github.com/lueschem/edi-qemu

  The call where systemd gets looping is the following:
  2837 getsockopt(3,1,31,274891889456,274887218756,274888927920) = -1 errno=34 (Numerical result out of range)

  Furthermore I also verified that the issue is not related to LXD.
  The same behavior can be reproduced using systemd-nspawn.

  This issue reported against systemd seems to be related:
  https://github.com/systemd/systemd/issues/11557

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1823790/+subscriptions


^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Qemu-devel] [Bug 1823790] Re: QEMU mishandling of SO_PEERSEC forces systemd into tight loop
  2019-04-08 20:34 [Qemu-devel] [Bug 1823790] [NEW] QEMU forces systemd into tight loop Matthias Lüscher
                   ` (4 preceding siblings ...)
  2019-08-16  6:46 ` Fritz Katze
@ 2019-08-16  9:05 ` Fritz Katze
  2020-01-29  6:20 ` Tobias Koch
                   ` (16 subsequent siblings)
  22 siblings, 0 replies; 25+ messages in thread
From: Fritz Katze @ 2019-08-16  9:05 UTC (permalink / raw)
  To: qemu-devel

I patched linux-user/syscall.c (see below, branch stable-2.11) which works around my problem.
So far so good, but the qemu-arm that i compiled is terribly slow compared to the one that came with Ubuntu 18.04. Any hints?
I configured as this:
./configure --static --enable-kvm --target-list=arm-linux-user

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 74d56e2ee6..4fa9a09b12 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -3185,6 +3185,8 @@ static abi_long do_getsockopt(int sockfd, int level, int optname,
         case TARGET_SO_SNDTIMEO:
         case TARGET_SO_PEERNAME:
             goto unimplemented;
+        case TARGET_SO_PEERSEC: /* added to escape infinite loop */
+            goto unimplemented;
         case TARGET_SO_PEERCRED: {
             struct ucred cr;
             socklen_t crlen;

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1823790

Title:
  QEMU mishandling of SO_PEERSEC forces systemd into tight loop

Status in QEMU:
  New

Bug description:
  While building Debian images for embedded ARM target systems I
  detected that QEMU seems to force newer systemd daemons into a tight
  loop.

  My setup is the following:

  Host machine: Ubuntu 18.04, amd64
  LXD container: Debian Buster, arm64, systemd 241
  QEMU: qemu-aarch64-static, 4.0.0-rc2 (custom build) and 3.1.0 (Debian 1:3.1+dfsg-7)

  To easily reproduce the issue I have created the following repository:
  https://github.com/lueschem/edi-qemu

  The call where systemd gets looping is the following:
  2837 getsockopt(3,1,31,274891889456,274887218756,274888927920) = -1 errno=34 (Numerical result out of range)

  Furthermore I also verified that the issue is not related to LXD.
  The same behavior can be reproduced using systemd-nspawn.

  This issue reported against systemd seems to be related:
  https://github.com/systemd/systemd/issues/11557

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1823790/+subscriptions


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [Bug 1823790] Re: QEMU mishandling of SO_PEERSEC forces systemd into tight loop
  2019-04-08 20:34 [Qemu-devel] [Bug 1823790] [NEW] QEMU forces systemd into tight loop Matthias Lüscher
                   ` (5 preceding siblings ...)
  2019-08-16  9:05 ` Fritz Katze
@ 2020-01-29  6:20 ` Tobias Koch
  2020-01-29  6:52 ` Tobias Koch
                   ` (15 subsequent siblings)
  22 siblings, 0 replies; 25+ messages in thread
From: Tobias Koch @ 2020-01-29  6:20 UTC (permalink / raw)
  To: qemu-devel

I'm a bit surprised that this bug doesn't get more attention, as it
makes it very hard to run qemu-emulated containers of Bionic hosted on
Bionic. Running such containers is a common way to cross-compile
packages for foreign architectures in the absence of sufficiently
powerful target HW.

The documentation on SO_PEERSEC is indeed sparse, but I do want to
second Fritz in his approach. I don't see a reason, why treating the
payload as incorrect and throwing it back at the application is better
than handling it and saying it is not implemented (which is the case).

Arguably, applications should be fixed to handle the error correctly,
but I'm afraid that is a can of worms. I have encountered the same
problem with systemd, apt and getent. Would the maintainers be open to
an SRU request on QEMU for this?

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1823790

Title:
  QEMU mishandling of SO_PEERSEC forces systemd into tight loop

Status in QEMU:
  New

Bug description:
  While building Debian images for embedded ARM target systems I
  detected that QEMU seems to force newer systemd daemons into a tight
  loop.

  My setup is the following:

  Host machine: Ubuntu 18.04, amd64
  LXD container: Debian Buster, arm64, systemd 241
  QEMU: qemu-aarch64-static, 4.0.0-rc2 (custom build) and 3.1.0 (Debian 1:3.1+dfsg-7)

  To easily reproduce the issue I have created the following repository:
  https://github.com/lueschem/edi-qemu

  The call where systemd gets looping is the following:
  2837 getsockopt(3,1,31,274891889456,274887218756,274888927920) = -1 errno=34 (Numerical result out of range)

  Furthermore I also verified that the issue is not related to LXD.
  The same behavior can be reproduced using systemd-nspawn.

  This issue reported against systemd seems to be related:
  https://github.com/systemd/systemd/issues/11557

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1823790/+subscriptions


^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Bug 1823790] Re: QEMU mishandling of SO_PEERSEC forces systemd into tight loop
  2019-04-08 20:34 [Qemu-devel] [Bug 1823790] [NEW] QEMU forces systemd into tight loop Matthias Lüscher
                   ` (6 preceding siblings ...)
  2020-01-29  6:20 ` Tobias Koch
@ 2020-01-29  6:52 ` Tobias Koch
  2020-01-31 15:40 ` Laurent Vivier
                   ` (14 subsequent siblings)
  22 siblings, 0 replies; 25+ messages in thread
From: Tobias Koch @ 2020-01-29  6:52 UTC (permalink / raw)
  To: qemu-devel

** Changed in: qemu
       Status: New => Confirmed

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1823790

Title:
  QEMU mishandling of SO_PEERSEC forces systemd into tight loop

Status in QEMU:
  Confirmed

Bug description:
  While building Debian images for embedded ARM target systems I
  detected that QEMU seems to force newer systemd daemons into a tight
  loop.

  My setup is the following:

  Host machine: Ubuntu 18.04, amd64
  LXD container: Debian Buster, arm64, systemd 241
  QEMU: qemu-aarch64-static, 4.0.0-rc2 (custom build) and 3.1.0 (Debian 1:3.1+dfsg-7)

  To easily reproduce the issue I have created the following repository:
  https://github.com/lueschem/edi-qemu

  The call where systemd gets looping is the following:
  2837 getsockopt(3,1,31,274891889456,274887218756,274888927920) = -1 errno=34 (Numerical result out of range)

  Furthermore I also verified that the issue is not related to LXD.
  The same behavior can be reproduced using systemd-nspawn.

  This issue reported against systemd seems to be related:
  https://github.com/systemd/systemd/issues/11557

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1823790/+subscriptions


^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Bug 1823790] Re: QEMU mishandling of SO_PEERSEC forces systemd into tight loop
  2019-04-08 20:34 [Qemu-devel] [Bug 1823790] [NEW] QEMU forces systemd into tight loop Matthias Lüscher
                   ` (7 preceding siblings ...)
  2020-01-29  6:52 ` Tobias Koch
@ 2020-01-31 15:40 ` Laurent Vivier
  2020-01-31 20:51 ` Laurent Vivier
                   ` (13 subsequent siblings)
  22 siblings, 0 replies; 25+ messages in thread
From: Laurent Vivier @ 2020-01-31 15:40 UTC (permalink / raw)
  To: qemu-devel

** Changed in: qemu
     Assignee: (unassigned) => Laurent Vivier (laurent-vivier)

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1823790

Title:
  QEMU mishandling of SO_PEERSEC forces systemd into tight loop

Status in QEMU:
  Confirmed

Bug description:
  While building Debian images for embedded ARM target systems I
  detected that QEMU seems to force newer systemd daemons into a tight
  loop.

  My setup is the following:

  Host machine: Ubuntu 18.04, amd64
  LXD container: Debian Buster, arm64, systemd 241
  QEMU: qemu-aarch64-static, 4.0.0-rc2 (custom build) and 3.1.0 (Debian 1:3.1+dfsg-7)

  To easily reproduce the issue I have created the following repository:
  https://github.com/lueschem/edi-qemu

  The call where systemd gets looping is the following:
  2837 getsockopt(3,1,31,274891889456,274887218756,274888927920) = -1 errno=34 (Numerical result out of range)

  Furthermore I also verified that the issue is not related to LXD.
  The same behavior can be reproduced using systemd-nspawn.

  This issue reported against systemd seems to be related:
  https://github.com/systemd/systemd/issues/11557

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1823790/+subscriptions


^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Bug 1823790] Re: QEMU mishandling of SO_PEERSEC forces systemd into tight loop
  2019-04-08 20:34 [Qemu-devel] [Bug 1823790] [NEW] QEMU forces systemd into tight loop Matthias Lüscher
                   ` (8 preceding siblings ...)
  2020-01-31 15:40 ` Laurent Vivier
@ 2020-01-31 20:51 ` Laurent Vivier
  2020-02-03 13:54   ` Matthias Lüscher
  2020-02-03  8:07 ` Tobias Koch
                   ` (12 subsequent siblings)
  22 siblings, 1 reply; 25+ messages in thread
From: Laurent Vivier @ 2020-01-31 20:51 UTC (permalink / raw)
  To: qemu-devel

Could you test the attached patch?

** Patch added: "Implement SO_PEERSEC"
   https://bugs.launchpad.net/qemu/+bug/1823790/+attachment/5324494/+files/0001-linux-user-implement-TARGET_SO_PEERSEC.patch

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1823790

Title:
  QEMU mishandling of SO_PEERSEC forces systemd into tight loop

Status in QEMU:
  Confirmed

Bug description:
  While building Debian images for embedded ARM target systems I
  detected that QEMU seems to force newer systemd daemons into a tight
  loop.

  My setup is the following:

  Host machine: Ubuntu 18.04, amd64
  LXD container: Debian Buster, arm64, systemd 241
  QEMU: qemu-aarch64-static, 4.0.0-rc2 (custom build) and 3.1.0 (Debian 1:3.1+dfsg-7)

  To easily reproduce the issue I have created the following repository:
  https://github.com/lueschem/edi-qemu

  The call where systemd gets looping is the following:
  2837 getsockopt(3,1,31,274891889456,274887218756,274888927920) = -1 errno=34 (Numerical result out of range)

  Furthermore I also verified that the issue is not related to LXD.
  The same behavior can be reproduced using systemd-nspawn.

  This issue reported against systemd seems to be related:
  https://github.com/systemd/systemd/issues/11557

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1823790/+subscriptions


^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Bug 1823790] Re: QEMU mishandling of SO_PEERSEC forces systemd into tight loop
  2019-04-08 20:34 [Qemu-devel] [Bug 1823790] [NEW] QEMU forces systemd into tight loop Matthias Lüscher
                   ` (9 preceding siblings ...)
  2020-01-31 20:51 ` Laurent Vivier
@ 2020-02-03  8:07 ` Tobias Koch
  2020-02-04 12:51 ` Tobias Koch
                   ` (11 subsequent siblings)
  22 siblings, 0 replies; 25+ messages in thread
From: Tobias Koch @ 2020-02-03  8:07 UTC (permalink / raw)
  To: qemu-devel

Thanks, Laurent! I'll get back to you, asap.

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1823790

Title:
  QEMU mishandling of SO_PEERSEC forces systemd into tight loop

Status in QEMU:
  Confirmed

Bug description:
  While building Debian images for embedded ARM target systems I
  detected that QEMU seems to force newer systemd daemons into a tight
  loop.

  My setup is the following:

  Host machine: Ubuntu 18.04, amd64
  LXD container: Debian Buster, arm64, systemd 241
  QEMU: qemu-aarch64-static, 4.0.0-rc2 (custom build) and 3.1.0 (Debian 1:3.1+dfsg-7)

  To easily reproduce the issue I have created the following repository:
  https://github.com/lueschem/edi-qemu

  The call where systemd gets looping is the following:
  2837 getsockopt(3,1,31,274891889456,274887218756,274888927920) = -1 errno=34 (Numerical result out of range)

  Furthermore I also verified that the issue is not related to LXD.
  The same behavior can be reproduced using systemd-nspawn.

  This issue reported against systemd seems to be related:
  https://github.com/systemd/systemd/issues/11557

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1823790/+subscriptions


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [Bug 1823790] Re: QEMU mishandling of SO_PEERSEC forces systemd into tight loop
  2020-01-31 20:51 ` Laurent Vivier
@ 2020-02-03 13:54   ` Matthias Lüscher
  0 siblings, 0 replies; 25+ messages in thread
From: Matthias Lüscher @ 2020-02-03 13:54 UTC (permalink / raw)
  To: qemu-devel

> Could you test the attached patch?
>

Works great!

This is my test setup:

Host machine: Ubuntu 18.04, amd64
LXD container: Debian Buster, arm64, systemd 241
QEMU: qemu-aarch64(-static), compiled from source (4.2.0), patched with
your patch.

Many thanks!
Matthias

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1823790

Title:
  QEMU mishandling of SO_PEERSEC forces systemd into tight loop

Status in QEMU:
  Confirmed

Bug description:
  While building Debian images for embedded ARM target systems I
  detected that QEMU seems to force newer systemd daemons into a tight
  loop.

  My setup is the following:

  Host machine: Ubuntu 18.04, amd64
  LXD container: Debian Buster, arm64, systemd 241
  QEMU: qemu-aarch64-static, 4.0.0-rc2 (custom build) and 3.1.0 (Debian 1:3.1+dfsg-7)

  To easily reproduce the issue I have created the following repository:
  https://github.com/lueschem/edi-qemu

  The call where systemd gets looping is the following:
  2837 getsockopt(3,1,31,274891889456,274887218756,274888927920) = -1 errno=34 (Numerical result out of range)

  Furthermore I also verified that the issue is not related to LXD.
  The same behavior can be reproduced using systemd-nspawn.

  This issue reported against systemd seems to be related:
  https://github.com/systemd/systemd/issues/11557

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1823790/+subscriptions


^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Bug 1823790] Re: QEMU mishandling of SO_PEERSEC forces systemd into tight loop
  2019-04-08 20:34 [Qemu-devel] [Bug 1823790] [NEW] QEMU forces systemd into tight loop Matthias Lüscher
                   ` (10 preceding siblings ...)
  2020-02-03  8:07 ` Tobias Koch
@ 2020-02-04 12:51 ` Tobias Koch
  2020-02-08 12:03 ` zebul666
                   ` (10 subsequent siblings)
  22 siblings, 0 replies; 25+ messages in thread
From: Tobias Koch @ 2020-02-04 12:51 UTC (permalink / raw)
  To: qemu-devel

I carried out the following test:

* fetched the QEMU coming with 18.04,
* added this patch,
* built an LXD container with arch arm64 and the patched qemu-aarch64-static inside,
* launched it on amd64

Previously various systemd services would not come up properly, now they
are running like a charm. The only grief I have is that network
configuration does not work, but that is due to

    # ip addr
    Unsupported setsockopt level=270 optname=11

which is a different story.

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1823790

Title:
  QEMU mishandling of SO_PEERSEC forces systemd into tight loop

Status in QEMU:
  Confirmed

Bug description:
  While building Debian images for embedded ARM target systems I
  detected that QEMU seems to force newer systemd daemons into a tight
  loop.

  My setup is the following:

  Host machine: Ubuntu 18.04, amd64
  LXD container: Debian Buster, arm64, systemd 241
  QEMU: qemu-aarch64-static, 4.0.0-rc2 (custom build) and 3.1.0 (Debian 1:3.1+dfsg-7)

  To easily reproduce the issue I have created the following repository:
  https://github.com/lueschem/edi-qemu

  The call where systemd gets looping is the following:
  2837 getsockopt(3,1,31,274891889456,274887218756,274888927920) = -1 errno=34 (Numerical result out of range)

  Furthermore I also verified that the issue is not related to LXD.
  The same behavior can be reproduced using systemd-nspawn.

  This issue reported against systemd seems to be related:
  https://github.com/systemd/systemd/issues/11557

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1823790/+subscriptions


^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Bug 1823790] Re: QEMU mishandling of SO_PEERSEC forces systemd into tight loop
  2019-04-08 20:34 [Qemu-devel] [Bug 1823790] [NEW] QEMU forces systemd into tight loop Matthias Lüscher
                   ` (11 preceding siblings ...)
  2020-02-04 12:51 ` Tobias Koch
@ 2020-02-08 12:03 ` zebul666
  2020-02-20  6:56 ` Charlie Sharpsteen
                   ` (9 subsequent siblings)
  22 siblings, 0 replies; 25+ messages in thread
From: zebul666 @ 2020-02-08 12:03 UTC (permalink / raw)
  To: qemu-devel

Well, it's kind of irrelevant but I am trying that on archlinux and this
does not work for me.

Using systemd-244.2-1 and qemu-user-static-4.2 that I built with
Laurent's patch. May be I have done something wrong ?

I still get that error that leads me here:

Failed to enqueue loopback interface start request: Operation not supported
Caught <SEGV>, dumped core as pid 3.
Exiting PID 1...

I am trying to boot with systemd-nspawn an archlinux-arm built for a
rpi0. That's fine if I don't boot it.

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1823790

Title:
  QEMU mishandling of SO_PEERSEC forces systemd into tight loop

Status in QEMU:
  Confirmed

Bug description:
  While building Debian images for embedded ARM target systems I
  detected that QEMU seems to force newer systemd daemons into a tight
  loop.

  My setup is the following:

  Host machine: Ubuntu 18.04, amd64
  LXD container: Debian Buster, arm64, systemd 241
  QEMU: qemu-aarch64-static, 4.0.0-rc2 (custom build) and 3.1.0 (Debian 1:3.1+dfsg-7)

  To easily reproduce the issue I have created the following repository:
  https://github.com/lueschem/edi-qemu

  The call where systemd gets looping is the following:
  2837 getsockopt(3,1,31,274891889456,274887218756,274888927920) = -1 errno=34 (Numerical result out of range)

  Furthermore I also verified that the issue is not related to LXD.
  The same behavior can be reproduced using systemd-nspawn.

  This issue reported against systemd seems to be related:
  https://github.com/systemd/systemd/issues/11557

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1823790/+subscriptions


^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Bug 1823790] Re: QEMU mishandling of SO_PEERSEC forces systemd into tight loop
  2019-04-08 20:34 [Qemu-devel] [Bug 1823790] [NEW] QEMU forces systemd into tight loop Matthias Lüscher
                   ` (12 preceding siblings ...)
  2020-02-08 12:03 ` zebul666
@ 2020-02-20  6:56 ` Charlie Sharpsteen
  2020-02-20 12:21 ` Laurent Vivier
                   ` (8 subsequent siblings)
  22 siblings, 0 replies; 25+ messages in thread
From: Charlie Sharpsteen @ 2020-02-20  6:56 UTC (permalink / raw)
  To: qemu-devel

Laurent's patch worked for me as well.

I grabbed the source for the Debian 10 qemu-user-static package,
qemu_3.1+dfsg-8+deb10u3, applied the patch and re-built the qemu-arm-
static binary. Copying the new binary into a Docker image based on
arm32v7/debian:10-slim allowed /sbin/init to bring up the container with
a responsive systemctl command.

Prior to the patch, systemd did not start any services inside the
container and systemctl would hang when executed directly.

Thanks!
-Charlie

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1823790

Title:
  QEMU mishandling of SO_PEERSEC forces systemd into tight loop

Status in QEMU:
  Confirmed

Bug description:
  While building Debian images for embedded ARM target systems I
  detected that QEMU seems to force newer systemd daemons into a tight
  loop.

  My setup is the following:

  Host machine: Ubuntu 18.04, amd64
  LXD container: Debian Buster, arm64, systemd 241
  QEMU: qemu-aarch64-static, 4.0.0-rc2 (custom build) and 3.1.0 (Debian 1:3.1+dfsg-7)

  To easily reproduce the issue I have created the following repository:
  https://github.com/lueschem/edi-qemu

  The call where systemd gets looping is the following:
  2837 getsockopt(3,1,31,274891889456,274887218756,274888927920) = -1 errno=34 (Numerical result out of range)

  Furthermore I also verified that the issue is not related to LXD.
  The same behavior can be reproduced using systemd-nspawn.

  This issue reported against systemd seems to be related:
  https://github.com/systemd/systemd/issues/11557

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1823790/+subscriptions


^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Bug 1823790] Re: QEMU mishandling of SO_PEERSEC forces systemd into tight loop
  2019-04-08 20:34 [Qemu-devel] [Bug 1823790] [NEW] QEMU forces systemd into tight loop Matthias Lüscher
                   ` (13 preceding siblings ...)
  2020-02-20  6:56 ` Charlie Sharpsteen
@ 2020-02-20 12:21 ` Laurent Vivier
  2020-04-30 13:36 ` Laurent Vivier
                   ` (7 subsequent siblings)
  22 siblings, 0 replies; 25+ messages in thread
From: Laurent Vivier @ 2020-02-20 12:21 UTC (permalink / raw)
  To: qemu-devel

This seems to be the error reported in
https://bugs.launchpad.net/qemu/+bug/1857811

** Changed in: qemu
       Status: Confirmed => Fix Committed

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1823790

Title:
  QEMU mishandling of SO_PEERSEC forces systemd into tight loop

Status in QEMU:
  Fix Committed

Bug description:
  While building Debian images for embedded ARM target systems I
  detected that QEMU seems to force newer systemd daemons into a tight
  loop.

  My setup is the following:

  Host machine: Ubuntu 18.04, amd64
  LXD container: Debian Buster, arm64, systemd 241
  QEMU: qemu-aarch64-static, 4.0.0-rc2 (custom build) and 3.1.0 (Debian 1:3.1+dfsg-7)

  To easily reproduce the issue I have created the following repository:
  https://github.com/lueschem/edi-qemu

  The call where systemd gets looping is the following:
  2837 getsockopt(3,1,31,274891889456,274887218756,274888927920) = -1 errno=34 (Numerical result out of range)

  Furthermore I also verified that the issue is not related to LXD.
  The same behavior can be reproduced using systemd-nspawn.

  This issue reported against systemd seems to be related:
  https://github.com/systemd/systemd/issues/11557

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1823790/+subscriptions


^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Bug 1823790] Re: QEMU mishandling of SO_PEERSEC forces systemd into tight loop
  2019-04-08 20:34 [Qemu-devel] [Bug 1823790] [NEW] QEMU forces systemd into tight loop Matthias Lüscher
                   ` (14 preceding siblings ...)
  2020-02-20 12:21 ` Laurent Vivier
@ 2020-04-30 13:36 ` Laurent Vivier
  2020-08-18 14:04 ` Christian Ehrhardt 
                   ` (6 subsequent siblings)
  22 siblings, 0 replies; 25+ messages in thread
From: Laurent Vivier @ 2020-04-30 13:36 UTC (permalink / raw)
  To: qemu-devel

Fixed here:
https://git.qemu.org/?p=qemu.git;a=commitdiff;h=6d485a55d0cd


** Changed in: qemu
       Status: Fix Committed => Fix Released

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1823790

Title:
  QEMU mishandling of SO_PEERSEC forces systemd into tight loop

Status in QEMU:
  Fix Released

Bug description:
  While building Debian images for embedded ARM target systems I
  detected that QEMU seems to force newer systemd daemons into a tight
  loop.

  My setup is the following:

  Host machine: Ubuntu 18.04, amd64
  LXD container: Debian Buster, arm64, systemd 241
  QEMU: qemu-aarch64-static, 4.0.0-rc2 (custom build) and 3.1.0 (Debian 1:3.1+dfsg-7)

  To easily reproduce the issue I have created the following repository:
  https://github.com/lueschem/edi-qemu

  The call where systemd gets looping is the following:
  2837 getsockopt(3,1,31,274891889456,274887218756,274888927920) = -1 errno=34 (Numerical result out of range)

  Furthermore I also verified that the issue is not related to LXD.
  The same behavior can be reproduced using systemd-nspawn.

  This issue reported against systemd seems to be related:
  https://github.com/systemd/systemd/issues/11557

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1823790/+subscriptions


^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Bug 1823790] Re: QEMU mishandling of SO_PEERSEC forces systemd into tight loop
  2019-04-08 20:34 [Qemu-devel] [Bug 1823790] [NEW] QEMU forces systemd into tight loop Matthias Lüscher
                   ` (15 preceding siblings ...)
  2020-04-30 13:36 ` Laurent Vivier
@ 2020-08-18 14:04 ` Christian Ehrhardt 
  2020-08-18 14:05 ` Christian Ehrhardt 
                   ` (5 subsequent siblings)
  22 siblings, 0 replies; 25+ messages in thread
From: Christian Ehrhardt  @ 2020-08-18 14:04 UTC (permalink / raw)
  To: qemu-devel

Bisect worked and once you find it it seems obvious that this is exactly
our case:

commit 65b261a63a48fbb3b11193361d4ea0c38a3c3dfd
Author: Laurent Vivier <laurent@vivier.eu>
Date:   Thu Jul 9 09:23:32 2020 +0200

    linux-user: add netlink RTM_SETLINK command
    
    This command is needed to be able to boot systemd in a container.
    
      $ sudo systemd-nspawn -D /chroot/armhf/sid/ -b
      Spawning container sid on /chroot/armhf/sid.
      Press ^] three times within 1s to kill container.
      systemd 245.6-2 running in system mode.
      Detected virtualization systemd-nspawn.
      Detected architecture arm.
    
      Welcome to Debian GNU/Linux bullseye/sid!
    
      Set hostname to <virt-arm>.
      Failed to enqueue loopback interface start request: Operation not supported
      Caught <SEGV>, dumped core as pid 3.
      Exiting PID 1...
      Container sid failed with error code 255.
    
    Signed-off-by: Laurent Vivier <laurent@vivier.eu>
    Message-Id: <20200709072332.890440-2-laurent@vivier.eu>

 linux-user/fd-trans.c | 1 +
 1 file changed, 1 insertion(+)

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1823790

Title:
  QEMU mishandling of SO_PEERSEC forces systemd into tight loop

Status in QEMU:
  Fix Released

Bug description:
  While building Debian images for embedded ARM target systems I
  detected that QEMU seems to force newer systemd daemons into a tight
  loop.

  My setup is the following:

  Host machine: Ubuntu 18.04, amd64
  LXD container: Debian Buster, arm64, systemd 241
  QEMU: qemu-aarch64-static, 4.0.0-rc2 (custom build) and 3.1.0 (Debian 1:3.1+dfsg-7)

  To easily reproduce the issue I have created the following repository:
  https://github.com/lueschem/edi-qemu

  The call where systemd gets looping is the following:
  2837 getsockopt(3,1,31,274891889456,274887218756,274888927920) = -1 errno=34 (Numerical result out of range)

  Furthermore I also verified that the issue is not related to LXD.
  The same behavior can be reproduced using systemd-nspawn.

  This issue reported against systemd seems to be related:
  https://github.com/systemd/systemd/issues/11557

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1823790/+subscriptions


^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Bug 1823790] Re: QEMU mishandling of SO_PEERSEC forces systemd into tight loop
  2019-04-08 20:34 [Qemu-devel] [Bug 1823790] [NEW] QEMU forces systemd into tight loop Matthias Lüscher
                   ` (16 preceding siblings ...)
  2020-08-18 14:04 ` Christian Ehrhardt 
@ 2020-08-18 14:05 ` Christian Ehrhardt 
  2020-08-24 16:24 ` Steve Dodd
                   ` (4 subsequent siblings)
  22 siblings, 0 replies; 25+ messages in thread
From: Christian Ehrhardt  @ 2020-08-18 14:05 UTC (permalink / raw)
  To: qemu-devel

Sorry, posted this on the wrong bug :-/
I beg your pardon for the noise.

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1823790

Title:
  QEMU mishandling of SO_PEERSEC forces systemd into tight loop

Status in QEMU:
  Fix Released

Bug description:
  While building Debian images for embedded ARM target systems I
  detected that QEMU seems to force newer systemd daemons into a tight
  loop.

  My setup is the following:

  Host machine: Ubuntu 18.04, amd64
  LXD container: Debian Buster, arm64, systemd 241
  QEMU: qemu-aarch64-static, 4.0.0-rc2 (custom build) and 3.1.0 (Debian 1:3.1+dfsg-7)

  To easily reproduce the issue I have created the following repository:
  https://github.com/lueschem/edi-qemu

  The call where systemd gets looping is the following:
  2837 getsockopt(3,1,31,274891889456,274887218756,274888927920) = -1 errno=34 (Numerical result out of range)

  Furthermore I also verified that the issue is not related to LXD.
  The same behavior can be reproduced using systemd-nspawn.

  This issue reported against systemd seems to be related:
  https://github.com/systemd/systemd/issues/11557

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1823790/+subscriptions


^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Bug 1823790] Re: QEMU mishandling of SO_PEERSEC forces systemd into tight loop
  2019-04-08 20:34 [Qemu-devel] [Bug 1823790] [NEW] QEMU forces systemd into tight loop Matthias Lüscher
                   ` (17 preceding siblings ...)
  2020-08-18 14:05 ` Christian Ehrhardt 
@ 2020-08-24 16:24 ` Steve Dodd
  2020-08-27 16:54 ` Charlie Sharpsteen
                   ` (3 subsequent siblings)
  22 siblings, 0 replies; 25+ messages in thread
From: Steve Dodd @ 2020-08-24 16:24 UTC (permalink / raw)
  To: qemu-devel

Hmm, I'm using qemu-5.1.0 and I'm still seeing this (host is bionic,
container image is focal)

[..]
getsockopt(31, SOL_SOCKET, SO_PEERGROUPS, 0x7ffdbd58941c, [4]) = -1 ERANGE (Numerical result out of range)
getsockopt(31, SOL_SOCKET, SO_PEERGROUPS, 0x7ffdbd58941c, [4]) = -1 ERANGE (Numerical result out of range)
getsockopt(31, SOL_SOCKET, SO_PEERGROUPS, 0x7ffdbd58941c, [4]) = -1 ERANGE (Numerical result out of range)
[..]

Regression?

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1823790

Title:
  QEMU mishandling of SO_PEERSEC forces systemd into tight loop

Status in QEMU:
  Fix Released

Bug description:
  While building Debian images for embedded ARM target systems I
  detected that QEMU seems to force newer systemd daemons into a tight
  loop.

  My setup is the following:

  Host machine: Ubuntu 18.04, amd64
  LXD container: Debian Buster, arm64, systemd 241
  QEMU: qemu-aarch64-static, 4.0.0-rc2 (custom build) and 3.1.0 (Debian 1:3.1+dfsg-7)

  To easily reproduce the issue I have created the following repository:
  https://github.com/lueschem/edi-qemu

  The call where systemd gets looping is the following:
  2837 getsockopt(3,1,31,274891889456,274887218756,274888927920) = -1 errno=34 (Numerical result out of range)

  Furthermore I also verified that the issue is not related to LXD.
  The same behavior can be reproduced using systemd-nspawn.

  This issue reported against systemd seems to be related:
  https://github.com/systemd/systemd/issues/11557

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1823790/+subscriptions


^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Bug 1823790] Re: QEMU mishandling of SO_PEERSEC forces systemd into tight loop
  2019-04-08 20:34 [Qemu-devel] [Bug 1823790] [NEW] QEMU forces systemd into tight loop Matthias Lüscher
                   ` (18 preceding siblings ...)
  2020-08-24 16:24 ` Steve Dodd
@ 2020-08-27 16:54 ` Charlie Sharpsteen
  2020-08-28 20:14 ` Laurent Vivier
                   ` (2 subsequent siblings)
  22 siblings, 0 replies; 25+ messages in thread
From: Charlie Sharpsteen @ 2020-08-27 16:54 UTC (permalink / raw)
  To: qemu-devel

I can confirm that I see the same issue when trying to run Ubuntu 20.04
aarch64 in a container, strace shows a tight loop on:

getsockopt(31, SOL_SOCKET, SO_PEERGROUPS, 0x7ffdbd58941c, [4]) = -1
ERANGE

Re-building qemu-user-static with the patch has fixed Debian 10 armhf
for me, but the same re-build does not seem to help with this Ubuntu
issue.

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1823790

Title:
  QEMU mishandling of SO_PEERSEC forces systemd into tight loop

Status in QEMU:
  Fix Released

Bug description:
  While building Debian images for embedded ARM target systems I
  detected that QEMU seems to force newer systemd daemons into a tight
  loop.

  My setup is the following:

  Host machine: Ubuntu 18.04, amd64
  LXD container: Debian Buster, arm64, systemd 241
  QEMU: qemu-aarch64-static, 4.0.0-rc2 (custom build) and 3.1.0 (Debian 1:3.1+dfsg-7)

  To easily reproduce the issue I have created the following repository:
  https://github.com/lueschem/edi-qemu

  The call where systemd gets looping is the following:
  2837 getsockopt(3,1,31,274891889456,274887218756,274888927920) = -1 errno=34 (Numerical result out of range)

  Furthermore I also verified that the issue is not related to LXD.
  The same behavior can be reproduced using systemd-nspawn.

  This issue reported against systemd seems to be related:
  https://github.com/systemd/systemd/issues/11557

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1823790/+subscriptions


^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Bug 1823790] Re: QEMU mishandling of SO_PEERSEC forces systemd into tight loop
  2019-04-08 20:34 [Qemu-devel] [Bug 1823790] [NEW] QEMU forces systemd into tight loop Matthias Lüscher
                   ` (19 preceding siblings ...)
  2020-08-27 16:54 ` Charlie Sharpsteen
@ 2020-08-28 20:14 ` Laurent Vivier
  2020-08-28 21:03 ` Laurent Vivier
  2020-09-20 18:06 ` Charlie Sharpsteen
  22 siblings, 0 replies; 25+ messages in thread
From: Laurent Vivier @ 2020-08-28 20:14 UTC (permalink / raw)
  To: qemu-devel

SO_PEERGROUPS is not implemented and processed as an "int" (this
explains the ERANGE)

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1823790

Title:
  QEMU mishandling of SO_PEERSEC forces systemd into tight loop

Status in QEMU:
  Fix Released

Bug description:
  While building Debian images for embedded ARM target systems I
  detected that QEMU seems to force newer systemd daemons into a tight
  loop.

  My setup is the following:

  Host machine: Ubuntu 18.04, amd64
  LXD container: Debian Buster, arm64, systemd 241
  QEMU: qemu-aarch64-static, 4.0.0-rc2 (custom build) and 3.1.0 (Debian 1:3.1+dfsg-7)

  To easily reproduce the issue I have created the following repository:
  https://github.com/lueschem/edi-qemu

  The call where systemd gets looping is the following:
  2837 getsockopt(3,1,31,274891889456,274887218756,274888927920) = -1 errno=34 (Numerical result out of range)

  Furthermore I also verified that the issue is not related to LXD.
  The same behavior can be reproduced using systemd-nspawn.

  This issue reported against systemd seems to be related:
  https://github.com/systemd/systemd/issues/11557

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1823790/+subscriptions


^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Bug 1823790] Re: QEMU mishandling of SO_PEERSEC forces systemd into tight loop
  2019-04-08 20:34 [Qemu-devel] [Bug 1823790] [NEW] QEMU forces systemd into tight loop Matthias Lüscher
                   ` (20 preceding siblings ...)
  2020-08-28 20:14 ` Laurent Vivier
@ 2020-08-28 21:03 ` Laurent Vivier
  2020-09-20 18:06 ` Charlie Sharpsteen
  22 siblings, 0 replies; 25+ messages in thread
From: Laurent Vivier @ 2020-08-28 21:03 UTC (permalink / raw)
  To: qemu-devel

Could you try the attached patch?

** Patch added: "SO_PEERGROUPS.patch"
   https://bugs.launchpad.net/qemu/+bug/1823790/+attachment/5405549/+files/SO_PEERGROUPS.patch

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1823790

Title:
  QEMU mishandling of SO_PEERSEC forces systemd into tight loop

Status in QEMU:
  Fix Released

Bug description:
  While building Debian images for embedded ARM target systems I
  detected that QEMU seems to force newer systemd daemons into a tight
  loop.

  My setup is the following:

  Host machine: Ubuntu 18.04, amd64
  LXD container: Debian Buster, arm64, systemd 241
  QEMU: qemu-aarch64-static, 4.0.0-rc2 (custom build) and 3.1.0 (Debian 1:3.1+dfsg-7)

  To easily reproduce the issue I have created the following repository:
  https://github.com/lueschem/edi-qemu

  The call where systemd gets looping is the following:
  2837 getsockopt(3,1,31,274891889456,274887218756,274888927920) = -1 errno=34 (Numerical result out of range)

  Furthermore I also verified that the issue is not related to LXD.
  The same behavior can be reproduced using systemd-nspawn.

  This issue reported against systemd seems to be related:
  https://github.com/systemd/systemd/issues/11557

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1823790/+subscriptions


^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Bug 1823790] Re: QEMU mishandling of SO_PEERSEC forces systemd into tight loop
  2019-04-08 20:34 [Qemu-devel] [Bug 1823790] [NEW] QEMU forces systemd into tight loop Matthias Lüscher
                   ` (21 preceding siblings ...)
  2020-08-28 21:03 ` Laurent Vivier
@ 2020-09-20 18:06 ` Charlie Sharpsteen
  22 siblings, 0 replies; 25+ messages in thread
From: Charlie Sharpsteen @ 2020-09-20 18:06 UTC (permalink / raw)
  To: qemu-devel

In my case the issue with using Ubuntu 20.04 as a container host appears
to have come down to the use of the F, or "fix binary", flag by
binfmnt_misc:

# cat /proc/sys/fs/binfmt_misc/qemu-aarch64
enabled
interpreter /usr/bin/qemu-aarch64-static
flags: OCF
offset 0
magic 7f454c460201010000000000000000000200b700
mask ffffffffffffff00fffffffffffffffffeffffff

This appears to be new in Ubuntu 20.04 relative to 18.04 and results in
the qemu-user-static binaries being loaded and locked into memory _when
the package is installed_.

Therefore, what I observed as a regression of the issue was actually
just the packaged binaries now taking precedence over patched versions
that I had built and copied into place.

Ubuntu 20.04 ships QEMU 4.2. Using the QEMU 5.1 packages from Debian
Bullseye allows SystemD to run in a foreign architecture container
without spinning in a loop:

  https://packages.debian.org/bullseye/qemu-user-static

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1823790

Title:
  QEMU mishandling of SO_PEERSEC forces systemd into tight loop

Status in QEMU:
  Fix Released

Bug description:
  While building Debian images for embedded ARM target systems I
  detected that QEMU seems to force newer systemd daemons into a tight
  loop.

  My setup is the following:

  Host machine: Ubuntu 18.04, amd64
  LXD container: Debian Buster, arm64, systemd 241
  QEMU: qemu-aarch64-static, 4.0.0-rc2 (custom build) and 3.1.0 (Debian 1:3.1+dfsg-7)

  To easily reproduce the issue I have created the following repository:
  https://github.com/lueschem/edi-qemu

  The call where systemd gets looping is the following:
  2837 getsockopt(3,1,31,274891889456,274887218756,274888927920) = -1 errno=34 (Numerical result out of range)

  Furthermore I also verified that the issue is not related to LXD.
  The same behavior can be reproduced using systemd-nspawn.

  This issue reported against systemd seems to be related:
  https://github.com/systemd/systemd/issues/11557

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1823790/+subscriptions


^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2020-09-20 18:17 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-08 20:34 [Qemu-devel] [Bug 1823790] [NEW] QEMU forces systemd into tight loop Matthias Lüscher
2019-04-09 13:14 ` [Qemu-devel] [Bug 1823790] " Peter Maydell
2019-04-09 13:26 ` [Qemu-devel] [Bug 1823790] Re: QEMU mishandling of SO_PEERSEC " Peter Maydell
2019-04-11 20:36 ` Matthias Lüscher
2019-04-11 20:52 ` Matthias Lüscher
2019-08-16  6:46 ` Fritz Katze
2019-08-16  9:05 ` Fritz Katze
2020-01-29  6:20 ` Tobias Koch
2020-01-29  6:52 ` Tobias Koch
2020-01-31 15:40 ` Laurent Vivier
2020-01-31 20:51 ` Laurent Vivier
2020-02-03 13:54   ` Matthias Lüscher
2020-02-03  8:07 ` Tobias Koch
2020-02-04 12:51 ` Tobias Koch
2020-02-08 12:03 ` zebul666
2020-02-20  6:56 ` Charlie Sharpsteen
2020-02-20 12:21 ` Laurent Vivier
2020-04-30 13:36 ` Laurent Vivier
2020-08-18 14:04 ` Christian Ehrhardt 
2020-08-18 14:05 ` Christian Ehrhardt 
2020-08-24 16:24 ` Steve Dodd
2020-08-27 16:54 ` Charlie Sharpsteen
2020-08-28 20:14 ` Laurent Vivier
2020-08-28 21:03 ` Laurent Vivier
2020-09-20 18:06 ` Charlie Sharpsteen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.