On 3/18/25 11:36, Helge Deller wrote:
On 3/18/25 11:18, Andreas Schwab wrote:
Is there a generic way for a program to detect that is it being run
inside the linux-user emulation?
Yes, having a reliable way to detect it would be good.
In qemu-user emulation we could change the return values of
"uname --processor" and/or "uname --hardware-platform".
Currently both always return "unknown", but in qemu we could
return the arch of the host.
Another possibility is to extend prctl(), but I think uname is
easier to handle in scripts and such...
My current (unreliable) way to detect it is using uname.
The kernel string and arch name don't match:
(sid_hppa)root@paq:/# uname -a
Linux paq 6.1.0-31-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.128-1 (2025-02-07)
parisc GNU/Linux
(sid_hppa)root@paq:/# uname -r
6.1.0-31-amd64
(sid_hppa)root@paq:/# uname -m
parisc
This is a qemu-linux-user parisc(hppa) emulation running on x86-64.
The purpose for that would be to work around limitations of the
emulation, like CLONE_VFORK being unsupported.
yes, and robust futexes aren't supported either.
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.