All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lawrence Hunter <lawrence.hunter@codethink.co.uk>
To: Andreas Schwab <schwab@suse.de>
Cc: qemu-devel@nongnu.org
Subject: Re: Generic way to detect qemu linux-user emulation
Date: Wed, 25 Mar 2026 14:51:29 +0000	[thread overview]
Message-ID: <903bec01a83b0c5580cd513ab85b0552@codethink.co.uk> (raw)
In-Reply-To: <mvm1puuiqvu.fsf@suse.de>

Hello,

I don't have anything to offer around cython but I am also noticing this 
posix_spawn issue with systemd >= tag v255 running inside a cross-arch 
container. systemd specifically is fine under full QEMU or on an ARM64 
host but when ran cross and therefore through qemu-user I see systemd 
failing to fork off any processes i.e. immediately after posix_spawn the 
child process is dying with SIGCHLD.

```
[  OK  ] Reached target rpcbind.target.
Wed 2026-03-25 14:08:10 UTC src/core/service.c:1627: rpcbind.service: 
Will spawn child (service_enter_start): /usr/sbin/rpcbind
Wed 2026-03-25 14:08:10 UTC src/core/service.c:1658: rpcbind.service: 
Passing 3 fds to service
Wed 2026-03-25 14:08:11 UTC src/core/execute.c:345: rpcbind.service: 
About to execute: /usr/sbin/rpcbind "\$RPCBIND_OPTIONS" -w -f
Wed 2026-03-25 14:08:11 UTC src/core/execute.c:472: rpcbind.service: 
Forked /usr/sbin/rpcbind as 37
Wed 2026-03-25 14:08:11 UTC src/shared/fdset.c:71: Closing set fd 40 
(socket:[1181504])
Wed 2026-03-25 14:08:11 UTC src/shared/fdset.c:71: Closing set fd 39 
(socket:[1181503])
Wed 2026-03-25 14:08:11 UTC src/shared/fdset.c:71: Closing set fd 38 
(socket:[1181501])
Wed 2026-03-25 14:08:11 UTC src/shared/fdset.c:71: Closing set fd 41 
(socket:[1193529])
Wed 2026-03-25 14:08:11 UTC src/core/service.c:1269: rpcbind.service: 
Changed dead -> start
          Starting rpcbind.service...
Wed 2026-03-25 14:08:11 UTC src/basic/log.c:1456: Received SIGCHLD from 
PID 37 (11).
Wed 2026-03-25 14:08:11 UTC src/core/manager.c:2804: Child 37 (11) died 
(code=exited, status=1/FAILURE)
Wed 2026-03-25 14:08:11 UTC src/core/manager.c:2769: init.scope: Child 
37 belongs to init.scope.
Wed 2026-03-25 14:08:11 UTC src/core/manager.c:2769: rpcbind.service: 
Child 37 belongs to rpcbind.service.
Wed 2026-03-25 14:08:11 UTC src/core/unit.c:6066: rpcbind.service: Main 
process exited, code=exited, status=1/FAILURE
Wed 2026-03-25 14:08:11 UTC src/core/unit.c:6024: rpcbind.service: 
Failed with result 'exit-code'.
Wed 2026-03-25 14:08:11 UTC src/core/service.c:1980: rpcbind.service: 
Service will not restart (restart setting)
Wed 2026-03-25 14:08:11 UTC src/core/service.c:1269: rpcbind.service: 
Changed start -> failed
Wed 2026-03-25 14:08:11 UTC src/core/job.c:997: rpcbind.service: Job 91 
rpcbind.service/start finished, result=failed
[FAILED] Failed to start rpcbind.service.
See 'systemctl status rpcbind.service' for details.
```

I have narrowed it down to 
https://github.com/systemd/systemd/commit/bb5232b6a3b8af075ee06cc87416e5f49a6170d3 
as being the change which breaks qemu-user mode with a bisect, and the 
key bit seems to be around 
https://github.com/systemd/systemd/blob/7e37e01768e2f223750ead2c9e08b4490243b8d1/src/basic/process-util.c#L2110 
other fixes I found online around credentials or protect/restrictions do 
not seem to make a difference.

This can be reproduced by:
```
docker run --privileged --platform linux/arm64 -it fedora:40 /bin/bash
$ dnf install -y systemd
$ exec /sbin/init
```

Any help around this issue would be greatly helpful too.

Best,
Lawrence

On 2025-03-18 10:18, Andreas Schwab wrote:
> Is there a generic way for a program to detect that is it being run
> inside the linux-user emulation?
> 
> The purpose for that would be to work around limitations of the
> emulation, like CLONE_VFORK being unsupported.  For example, python >=
> 3.13 needs to avoid using posix_spawn in that case, because the
> emulation of CLONE_VFORK as a true fork makes it impossible for it to
> report errors back to the parent process.
> 
> --
> Andreas Schwab, SUSE Labs, schwab@suse.de
> GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA 
> B9D7
> "And now for something completely different."


      parent reply	other threads:[~2026-03-25 16:40 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-18 10:18 Generic way to detect qemu linux-user emulation Andreas Schwab
2025-03-18 10:36 ` Helge Deller
2025-03-18 10:45   ` Helge Deller
2025-03-18 10:53   ` Peter Maydell
2025-03-18 11:58     ` Daniel P. Berrangé
2025-03-18 12:34       ` Andreas Schwab
2025-03-18 12:43         ` Daniel P. Berrangé
2025-03-18 13:06           ` Peter Maydell
2025-03-18 13:54             ` Daniel P. Berrangé
2025-03-18 14:17               ` Andreas Schwab
2025-03-18 17:32                 ` Daniel P. Berrangé
2025-03-18 15:04               ` Peter Maydell
2025-03-18 17:08                 ` Peter Maydell
2025-03-18 17:18                   ` Daniel P. Berrangé
2025-03-18 17:48                     ` Peter Maydell
2026-03-25 17:08                 ` Florian Weimer
2025-03-18 11:10   ` Andreas Schwab
2026-03-25 14:51 ` Lawrence Hunter [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=903bec01a83b0c5580cd513ab85b0552@codethink.co.uk \
    --to=lawrence.hunter@codethink.co.uk \
    --cc=qemu-devel@nongnu.org \
    --cc=schwab@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.