Skip to contentSkip to conversation

qemu-riscv32 usermode still broken?

DISCUSSION Applied Andreas K. Huettel 4 participants 11 messages Sep 12, 2023 – Jun 12, 2024

lore
Share & tools
lore
#0 lore raw

Dear all,

I've once more tried to build up a riscv32 linux install in a qemu-riscv32 usermode systemd-nspawn, and am running into the same problems as some time ago...

https://dev.gentoo.org/~dilfridge/riscv32/riscv32.tar.xz (220M)

The problems manifest themselves mostly in bash; if I replace /bin/bash with a static x86-64 binary (in the tarball as /bin/bash.amd64), bypassing qemu, I can make the chroot rebuild itself completely.

https://lists.gnu.org/archive/html/bug-bash/2023-09/msg00119.html
^ Here I'm trying to find out more.

Bash tests apparently indicate that argv[0] is overwritten, and that reading through a pipe or from /dev/tty fails or loses data.

Apart from the bash testsuite failing, symptoms are as follows:

* Something seems wrong in the signal handling (?):
--- our package manager (bash/python combo, there bash) hangs reproducibly at one point.
--- when I run a console program and try to background it with ctl-z, it hangs
(only the first time per bash instance, it seems)
repeated ctl-c gets me back to the shell, then the program is in the
background

riscv32 ~ # python
Python 3.11.5 (main, Aug 31 2023, 21:56:30) [GCC 13.2.1 20230826] on linux Type "help", "copyright", "credits" or "license" for more information.

Quoted 1 line
Quoted 1 line
Quoted 1 line

[1]+ Stopped python
^C^C^C^C^C^C^C
riscv32 ~ # ^C
riscv32 ~ #
riscv32 ~ # jobs
[1]+ Stopped python
riscv32 ~ # fg
python

Quoted 1 line
Quoted 1 line
Quoted 1 line

--- make, when building something, seems to always start only one job in parallel

Any advice or debugging would be appreciated.

If we get this running then I can set up regular riscv32 Gentoo stage builds within a week. [*]

Thanks in advance,
Andreas

PS.
huettel@pinacolada ~ $ /var/lib/machines/riscv32/usr/bin/qemu-riscv32 -version qemu-riscv32 version 8.1.0
Copyright (c) 2003-2023 Fabrice Bellard and the QEMU Project developers

[*] https://www.gentoo.org/downloads/#riscv

Signature · 4 lines
Andreas K. Hüttel
[email protected]
Gentoo Linux developer
(council, toolchain, base-system, perl, libreoffice)
#1 lore raw
Quoted 15 lines · Andreas K. Huettel

Dear all,

I've once more tried to build up a riscv32 linux install in a qemu-riscv32 usermode systemd-nspawn, and am running into the same problems as some time ago...

https://dev.gentoo.org/~dilfridge/riscv32/riscv32.tar.xz (220M)

The problems manifest themselves mostly in bash; if I replace /bin/bash with a static x86-64 binary (in the tarball as /bin/bash.amd64), bypassing qemu, I can make the chroot rebuild itself completely.

https://lists.gnu.org/archive/html/bug-bash/2023-09/msg00119.html
^ Here I'm trying to find out more.

Quoted 6 lines

Bash tests apparently indicate that argv[0] is overwritten, and that reading through a pipe or from /dev/tty fails or loses data.

Apart from the bash testsuite failing, symptoms are as follows:

* Something seems wrong in the signal handling (?):

If it is wrong for signal handling and for 32-bit, I guess it may be fixed by this patch

https://www.mail-archive.com/[email protected]/msg981238.html

And this patch has been merged into master branch yesterday.

May be you can have a try based on the master branch.

Thanks,
Zhiwei

Quoted 39 lines

--- our package manager (bash/python combo, there bash) hangs reproducibly at one point.
--- when I run a console program and try to background it with ctl-z, it hangs
(only the first time per bash instance, it seems)
repeated ctl-c gets me back to the shell, then the program is in the
background

riscv32 ~ # python
Python 3.11.5 (main, Aug 31 2023, 21:56:30) [GCC 13.2.1 20230826] on linux Type "help", "copyright", "credits" or "license" for more information.
[1]+ Stopped python
^C^C^C^C^C^C^C
riscv32 ~ # ^C
riscv32 ~ #
riscv32 ~ # jobs
[1]+ Stopped python
riscv32 ~ # fg
python

--- make, when building something, seems to always start only one job in parallel

Any advice or debugging would be appreciated.

If we get this running then I can set up regular riscv32 Gentoo stage builds within a week. [*]

Thanks in advance,
Andreas

PS.
huettel@pinacolada ~ $ /var/lib/machines/riscv32/usr/bin/qemu-riscv32 -version qemu-riscv32 version 8.1.0
Copyright (c) 2003-2023 Fabrice Bellard and the QEMU Project developers

[*] https://www.gentoo.org/downloads/#riscv

#2 lore raw
Quoted 2 lines · LIU Zhiwei

On 2023/9/13 6:31, Andreas K. Huettel wrote:

..

Quoted 7 lines
Quoted 1 line

* Something seems wrong in the signal handling (?):

If it is wrong for signal handling and for 32-bit, I guess it may be fixed by this patch

https://www.mail-archive.com/[email protected]/msg981238.html

And this patch has been merged into master branch yesterday.

I picked this one up for stable yesterday, scheduled to be released on Sep-21.

Thanks,

/mjt

#3 lore raw

Am Mittwoch, 13. September 2023, 10:06:01 CEST schrieb Michael Tokarev:

Quoted 6 lines
Quoted 2 lines · LIU Zhiwei

On 2023/9/13 6:31, Andreas K. Huettel wrote:

..

Quoted 2 lines
Quoted 1 line

* Something seems wrong in the signal handling (?):

Quoted 8 lines
Quoted 5 lines

If it is wrong for signal handling and for 32-bit, I guess it may be fixed by this patch

https://www.mail-archive.com/[email protected]/msg981238.html

And this patch has been merged into master branch yesterday.

I picked this one up for stable yesterday, scheduled to be released on Sep-21.

Oh great, thanks! I'll test this and report back.
-a

Quoted 7 lines

Thanks,

/mjt

Signature · 4 lines
Andreas K. Hüttel
[email protected]
Gentoo Linux developer
(council, toolchain, base-system, perl, libreoffice)
#4 lore raw
In reply to LIU Zhiwei
Quoted 10 lines
Quoted 9 lines

https://lists.gnu.org/archive/html/bug-bash/2023-09/msg00119.html
^ Here I'm trying to find out more.

Bash tests apparently indicate that argv[0] is overwritten, and that reading through a pipe or from /dev/tty fails or loses data.

Apart from the bash testsuite failing, symptoms are as follows:

* Something seems wrong in the signal handling (?):

Quoted 8 lines

If it is wrong for signal handling and for 32-bit, I guess it may be fixed by this patch

https://www.mail-archive.com/[email protected]/msg981238.html

And this patch has been merged into master branch yesterday.

May be you can have a try based on the master branch.

I added the patch to 8.0.3 (easier for the moment), and this did unfortunately *not* lead to any improvements.

More debugging coming (weekend hopefully).

However, in the meantime on the GNU Make tracker Alejandro Colomar pointed me to another detail based on my oddities [1]:

Quoted 6 lines

I think [make] it's failing here:

<https://git.savannah.gnu.org/cgit/make.git/tree/src/job.c#n757>

But it's failing with ENOENT, which is not one of the documented errors for wait(2):

So maybe another point to look at would be the origin of the return values of wait, and whether that's wired correctly for rv32...

[1] https://savannah.gnu.org/bugs/?64664

Signature · 4 lines
Andreas K. Hüttel
[email protected]
Gentoo Linux developer
(council, toolchain, base-system, perl, libreoffice)
#5 lore raw

Am Donnerstag, 14. September 2023, 03:22:49 CEST schrieb Andreas K. Huettel:

Quoted 13 lines
Quoted 13 lines
Quoted 9 lines

https://lists.gnu.org/archive/html/bug-bash/2023-09/msg00119.html
^ Here I'm trying to find out more.

Bash tests apparently indicate that argv[0] is overwritten, and that reading through a pipe or from /dev/tty fails or loses data.

Apart from the bash testsuite failing, symptoms are as follows:

* Something seems wrong in the signal handling (?):

If it is wrong for signal handling and for 32-bit, I guess it may be fixed by this patch

Quoted 8 lines
Quoted 5 lines

https://www.mail-archive.com/[email protected]/msg981238.html

And this patch has been merged into master branch yesterday.

May be you can have a try based on the master branch.

I added the patch to 8.0.3 (easier for the moment), and this did unfortunately *not* lead to any improvements.

Also with the patch on top of 8.1.0 no improvement or change.

Quoted 7 lines

However, in the meantime on the GNU Make tracker Alejandro Colomar pointed me to another detail based on my oddities [1]:

Quoted 4 lines

I think [make] it's failing here:

<https://git.savannah.gnu.org/cgit/make.git/tree/src/job.c#n757>

Quoted 7 lines
Quoted 2 lines

But it's failing with ENOENT, which is not one of the documented errors for wait(2):

So maybe another point to look at would be the origin of the return values of wait, and whether that's wired correctly for rv32...

[1] https://savannah.gnu.org/bugs/?64664

In the meantime I tried to nail down a reproducible hang in bash on this frankensystem with qemu's gdb interface. This also pointed towards child handling and wait [2].

[2] https://lists.gnu.org/archive/html/bug-bash/2023-09/msg00128.html

Some time ago we already debugged that corner, and Alistair Francis came up with a fix that improved the riscv32 situation back then [3]. Maybe that fix was somehow incomplete? Just speculating...

[3] https://bugs.launchpad.net/qemu/+bug/1906193

Signature · 4 lines
Andreas K. Hüttel
[email protected]
Gentoo Linux developer
(council, toolchain, base-system, perl, libreoffice)
#6 lore raw
Quoted 36 lines · Andreas K. Huettel

Am Donnerstag, 14. September 2023, 03:22:49 CEST schrieb Andreas K. Huettel:

Quoted 13 lines
Quoted 13 lines
Quoted 9 lines

https://lists.gnu.org/archive/html/bug-bash/2023-09/msg00119.html
^ Here I'm trying to find out more.

Bash tests apparently indicate that argv[0] is overwritten, and that reading through a pipe or from /dev/tty fails or loses data.

Apart from the bash testsuite failing, symptoms are as follows:

* Something seems wrong in the signal handling (?):

If it is wrong for signal handling and for 32-bit, I guess it may be fixed by this patch

Quoted 8 lines
Quoted 5 lines

https://www.mail-archive.com/[email protected]/msg981238.html

And this patch has been merged into master branch yesterday.

May be you can have a try based on the master branch.

I added the patch to 8.0.3 (easier for the moment), and this did unfortunately *not* lead to any improvements.

Also with the patch on top of 8.1.0 no improvement or change.

Quoted 10 lines

However, in the meantime on the GNU Make tracker Alejandro Colomar pointed me to another detail based on my oddities [1]:

Quoted 6 lines

I think [make] it's failing here:

<https://git.savannah.gnu.org/cgit/make.git/tree/src/job.c#n757>

But it's failing with ENOENT, which is not one of the documented errors for wait(2):

Quoted 8 lines
Quoted 4 lines

So maybe another point to look at would be the origin of the return values of wait, and whether that's wired correctly for rv32...

[1] https://savannah.gnu.org/bugs/?64664

In the meantime I tried to nail down a reproducible hang in bash on this frankensystem with qemu's gdb interface. This also pointed towards child handling and wait [2].

RV32 only has the time64 wait syscall, so it's possible there is a bug there which then wouldn't appear on other arches.

You can see the glibc implementation of wait here [1] to give you an idea of how complex it ends up being.

It would be great to get a strace of the failure to narrow down what it is. From there it should be not too hard to find and fix.

1: https://github.com/bminor/glibc/blob/bb5bbc20702981c287aa3e44640e7d2f2b9a28cf/sysdeps/unix/sysv/linux/wait4.c#L26

Alistair

Quoted 15 lines

[2] https://lists.gnu.org/archive/html/bug-bash/2023-09/msg00128.html

Some time ago we already debugged that corner, and Alistair Francis came up with a fix that improved the riscv32 situation back then [3]. Maybe that fix was somehow incomplete? Just speculating...

[3] https://bugs.launchpad.net/qemu/+bug/1906193

--
Andreas K. Hüttel
[email protected]
Gentoo Linux developer
(council, toolchain, base-system, perl, libreoffice)

#7 lore raw

Hi Alistair,

Quoted 2 lines

It would be great to get a strace of the failure to narrow down what it is. From there it should be not too hard to find and fix.

thanks a lot. Here's as much info as I could get with strace mechanisms.

1) What I did, without any tracing

pinacolada ~ # qemu-riscv32 -L /var/lib/machines/riscv32 /var/lib/machines/riscv32/bin/bash pinacolada ~ # python
Python 3.11.5 (main, Aug 27 2023, 18:39:05) [GCC 12.3.1 20230623] on linux Type "help", "copyright", "credits" or "license" for more information.

Quoted 1 line
Quoted 1 line
Quoted 1 line

[1]+ Stopped python
^C^C
pinacolada ~ # ^C
pinacolada ~ # fg
python

pinacolada ~ #
exit

* When I type Ctrl-Z at the python prompt, the terminal hangs.
* With several Ctrl-C I can get back to the riscv32 bash, and then python is suspended in the background.

* Now I did this again, first with qemu tracing system calls, then with strace tracing qemu
* In both cases, the log starts when I type "python", and ends (with quickly repeated output lines) after pressing Ctrl-Z

2)
pinacolada ~ # QEMU_STRACE=1 qemu-riscv32 -L /var/lib/machines/riscv32 /var/lib/machines/riscv32/bin/bash (QEMU_STRACE is getting unset in my bashrc, so no subprocesses are traced)

(...)
2472050 write(2,0xe56c0,58)pinacolada ~ # = 58
2472050 Unknown syscall 413
2472050 read(0,0x2b2aa29b,1) = 1
2472050 Unknown syscall 413
2472050 write(2,0xe56c0,1)p = 1
2472050 Unknown syscall 413
2472050 read(0,0x2b2aa29b,1) = 1
2472050 Unknown syscall 413
2472050 write(2,0xe56c0,1)y = 1
2472050 Unknown syscall 413
2472050 read(0,0x2b2aa29b,1) = 1
2472050 Unknown syscall 413
2472050 write(2,0xe56c0,1)t = 1
2472050 Unknown syscall 413
2472050 read(0,0x2b2aa29b,1) = 1
2472050 Unknown syscall 413
2472050 write(2,0xe56c0,1)h = 1
2472050 Unknown syscall 413
2472050 read(0,0x2b2aa29b,1) = 1
2472050 Unknown syscall 413
2472050 write(2,0xe56c0,1)o = 1
2472050 Unknown syscall 413
2472050 read(0,0x2b2aa29b,1) = 1
2472050 Unknown syscall 413
2472050 write(2,0xe56c0,1)n = 1
2472050 Unknown syscall 413
2472050 read(0,0x2b2aa29b,1) = 1
2472050 write(2,0xe56c0,1)
= 1
= 9050 write(2,0xe56c0,9)
2472050 ioctl(0,TCSETSW,{c_iflag = ICRNL|IXON|IXOFF|IUTF8,c_oflag = OPOST|ONLCR,c_cflag = B38400,CS8,CREAD,c_lflag = ISIG|ICANON|ECHO|ECHOE|ECHOK|ECHOCTL|ECHOKE|IEXTEN,c_cc = "",c_line = ''}) = 0 2472050 rt_sigaction(SIGINT,0x2b2aa1bc,0x2b2aa244) = 0
2472050 rt_sigaction(SIGHUP,0x2b2aa1bc,0x2b2aa244) = 0
2472050 rt_sigaction(SIGALRM,0x2b2aa1bc,0x2b2aa244) = 0
2472050 rt_sigaction(SIGWINCH,0x2b2aa1bc,0x2b2aa244) = 0
2472050 rt_sigaction(SIGINT,0x2b2aa14c,0x2b2aa1d4) = 0
2472050 clock_gettime64(CLOCK_REALTIME_COARSE,0x2b2aa268) = 0 ({tv_sec=1695154794,tv_nsec=760883171})
2472050 statx(AT_FDCWD,".",AT_NO_AUTOMOUNT|AT_STATX_SYNC_AS_STAT,STATX_BASIC_STATS,0x2b2aaa78) = 0
2472050 statx(AT_FDCWD,"/usr/local/sbin/python",AT_NO_AUTOMOUNT|AT_STATX_SYNC_AS_STAT,STATX_BASIC_STATS,0x2b2aa998) = -1 errno=2 (No such file or directory) 2472050 statx(AT_FDCWD,"/usr/local/bin/python",AT_NO_AUTOMOUNT|AT_STATX_SYNC_AS_STAT,STATX_BASIC_STATS,0x2b2aa998) = -1 errno=2 (No such file or directory)
2472050 statx(AT_FDCWD,"/usr/sbin/python",AT_NO_AUTOMOUNT|AT_STATX_SYNC_AS_STAT,STATX_BASIC_STATS,0x2b2aa998) = -1 errno=2 (No such file or directory)
2472050 statx(AT_FDCWD,"/usr/bin/python",AT_NO_AUTOMOUNT|AT_STATX_SYNC_AS_STAT,STATX_BASIC_STATS,0x2b2aa998) = 0
2472050 statx(AT_FDCWD,"/usr/bin/python",AT_NO_AUTOMOUNT|AT_STATX_SYNC_AS_STAT,STATX_BASIC_STATS,0x2b2aa8e8) = 0
2472050 geteuid() = 0
2472050 getegid() = 0
2472050 getuid() = 0
2472050 getgid() = 0
2472050 faccessat(AT_FDCWD,"/usr/bin/python",X_OK,AT_SYMLINK_NOFOLLOW|0x1da42089) = 0
2472050 statx(AT_FDCWD,"/usr/bin/python",AT_NO_AUTOMOUNT|AT_STATX_SYNC_AS_STAT,STATX_BASIC_STATS,0x2b2aa8e8) = 0
2472050 geteuid() = 0
2472050 getegid() = 0
2472050 getuid() = 0
2472050 getgid() = 0
2472050 faccessat(AT_FDCWD,"/usr/bin/python",R_OK,AT_SYMLINK_NOFOLLOW|0x1da42089) = 0
2472050 rt_sigprocmask(SIG_BLOCK,NULL,0x2b2aabec,8) = 0
2472050 rt_sigprocmask(SIG_BLOCK,0x2b2aaaec,0x2b2aab6c,8) = 0
2472050 rt_sigaction(SIGTERM,0x2b2aa85c,0x2b2aa8e4) = 0
2472050 rt_sigprocmask(SIG_BLOCK,0x2b2aa98c,0x2b2aaa0c,8) = 0
2472050 rt_sigprocmask(SIG_SETMASK,0x2b2aaa0c,NULL,8) = 0
2472050 pipe2(0x5560d3f4,0) = 0
2472050 clone(CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|0x11,child_stack=0x00000000,parent_tidptr=0x00000000,tls=0x00000000,child_tidptr=0x2b2d20c8) = 2472055 2472050 rt_sigaction(SIGTERM,0x2b2aa85c,0x2b2aa8e4) = 0
= 0
2472050 setpgid(2472055,2472055) = 0
2472055 set_robust_list(0x2b2d20cc,12) = 2472050 rt_sigprocmask(SIG_SETMASK,0x2b2aab6c,-1 errno=38 (Function not implemented)NULL,
8) = 0
2472055 getpid() = 2472055
2472055 rt_sigprocmask(SIG_SETMASK,0x55616e24,NULL,8) = 0
2472050 rt_sigprocmask(SIG_BLOCK,0x2b2aaaac,0x2b2aab2c,8) = 0
2472050 close(3) = 0
2472050 close(4) = 0
2472055 rt_sigaction(SIGTSTP,0x2b2aa84c,0x2b2aa8d4) = 0
2472055 rt_sigaction(SIGTTIN,0x2b2aa84c,0x2b2aa8d4) = 0
2472055 rt_sigaction(SIGTTOU,0x2b2aa85c,0x2b2aa8e4) = 0
2472055 setpgid(2472055,2472055) = 0
2472055 rt_sigprocmask(SIG_BLOCK,0x2b2aa99c,0x2b2aaa1c,8) = 0
2472055 ioctl(255,TIOCSPGRP,2472055) = 0
2472055 rt_sigprocmask(SIG_SETMASK,0x2b2aaa1c,NULL,8) = 0
2472050 ioctl(255,TIOCGPGRP,0x2b2aaa78) = 0 (2472055)2472055
close(4) = 0
2472050 rt_sigprocmask(SIG_SETMASK,0x2b2aab2c,NULL,2472055 8)read(3,0x2b2aaaeb,1) = 0 =
0
2472055 close(3) = 0
2472050 rt_sigprocmask(SIG_BLOCK,0x2b2aabac,0x2b2aac2c,8) = 0
2472055 rt_sigaction(SIGHUP,0x2b2aaacc,NULL) = 0
2472055 rt_sigaction(SIGILL,0x2b2aaacc,NULL) = 0
2472055 rt_sigaction(SIGTRAP,0x2b2aaacc,NULL) = 0
2472055 rt_sigaction(SIGIOT,0x2b2aaacc,NULL) = 0
2472055 rt_sigaction(SIGFPE,0x2b2aaacc,NULL) = 0
2472055 rt_sigaction(SIGBUS,0x2b2aaacc,NULL) = 0
2472055 rt_sigaction(SIGSEGV,0x2b2aaacc,NULL) = 0
2472055 rt_sigaction(SIGSYS,0x2b2aaacc,NULL) = 0
2472055 rt_sigaction(SIGPIPE,0x2b2aaacc,NULL) = 0
2472050 2472055 waitid(0,-1,0x2b2aaa7c,0xe)rt_sigaction(SIGALRM,0x2b2aaacc,NULL) = 0
2472055 rt_sigaction(SIGXCPU,0x2b2aaacc,NULL) = 0
2472055 rt_sigaction(SIGXFSZ,0x2b2aaacc,NULL) = 0
2472055 rt_sigaction(SIGVTALRM,0x2b2aaacc,NULL) = 0
2472055 rt_sigaction(SIGUSR1,0x2b2aaacc,NULL) = 0
2472055 rt_sigaction(SIGUSR2,0x2b2aaacc,NULL) = 0
2472055 rt_sigaction(SIGINT,0x2b2aaa0c,0x2b2aaa94) = 0
2472055 rt_sigaction(SIGQUIT,0x2b2aaa0c,0x2b2aaa94) = 0
2472055 rt_sigaction(SIGTERM,0x2b2aaa0c,0x2b2aaa94) = 0
2472055 rt_sigaction(SIGCHLD,0x2b2aaa0c,0x2b2aaa94) = 0
2472055 execve("/usr/bin/python",{"python",NULL})Python 3.11.5 (main, Aug 27 2023, 18:39:05) [GCC 12.3.1 20230623] on linux
Type "help", "copyright", "credits" or "license" for more information.

Quoted 1 line
Quoted 1 line
Quoted 1 line

= 0

2472050 rt_sigprocmask(SIG_BLOCK,0x2b2aa9ec,0x2b2aaa6c,8) = 0
2472050 rt_sigprocmask(SIG_SETMASK,0x2b2aaa6c,NULL,8) = 0
2472050 rt_sigprocmask(SIG_BLOCK,0x2b2aa9ec,0x2b2aaa6c,8) = 0
2472050 rt_sigprocmask(SIG_SETMASK,0x2b2aaa6c,NULL,8) = 0
2472050 rt_sigprocmask(SIG_BLOCK,0x2b2aaa6c,0x2b2aaaec,8) = 0
2472050 ioctl(255,TIOCSPGRP,2472050) = 0
2472050 rt_sigprocmask(SIG_SETMASK,0x2b2aaaec,NULL,8) = 0
2472050 ioctl(255,TCSETSW,{c_iflag = ICRNL|IXON|IXOFF|IUTF8,c_oflag = OPOST|ONLCR,c_cflag = B38400,CS8,CREAD,c_lflag = ISIG|ICANON|ECHO|ECHOE|ECHOK|ECHOCTL|ECHOKE|IEXTEN,c_cc = "",c_line = ''}) = 0 2472050 ioctl(255,TIOCGWINSZ,0x2b2aab74) = 0 ({49,194,1749,896})
2472050 write(2,0xe56c0,1)
= 1
2472050 openat(AT_FDCWD,"/usr/share/locale/locale.alias",O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
2472050 statx(3,"",AT_EMPTY_PATH|AT_NO_AUTOMOUNT|AT_STATX_SYNC_AS_STAT,STATX_BASIC_STATS,0x2b2aa3b8) = 0
2472050 read(3,0xf4d00,4096) = 2998
2472050 read(3,0xf4d00,4096) = 0
2472050 close(3) = 0
2472050 openat(AT_FDCWD,"/usr/share/locale/en_US.utf8/LC_MESSAGES/bash.mo",O_RDONLY|O_LARGEFILE) = -1 errno=2 (No such file or directory)
2472050 openat(AT_FDCWD,"/usr/share/locale/en_US/LC_MESSAGES/bash.mo",O_RDONLY|O_LARGEFILE) = -1 errno=2 (No such file or directory)
2472050 openat(AT_FDCWD,"/usr/share/locale/en.utf8/LC_MESSAGES/bash.mo",O_RDONLY|O_LARGEFILE) = -1 errno=2 (No such file or directory)
2472050 openat(AT_FDCWD,"/usr/share/locale/en/LC_MESSAGES/bash.mo",O_RDONLY|O_LARGEFILE) = -1 errno=2 (No such file or directory)
2472050 write(2,0xe56c0,37)[1]+ Stopped python
= 37
2472050 rt_sigprocmask(SIG_SETMASK,0x2b2aac2c,NULL,8) = 0
--- SIGCHLD {si_signo=SIGCHLD, si_code=5, si_pid=2472055, si_uid=0, si_status=20, si_utime=2, si_stime=0} ---
2472050 waitid(0,-1,0x2b2aa70c,0xf) = 0
2472050 waitid(0,-1,0x2b2aa70c,0xf) = 0
2472050 waitid(0,-1,0x2b2aa70c,0xf) = 0
2472050 waitid(0,-1,0x2b2aa70c,0xf) = 0
2472050 waitid(0,-1,0x2b2aa70c,0xf) = 0
2472050 waitid(0,-1,0x2b2aa70c,0xf) = 0
2472050 waitid(0,-1,0x2b2aa70c,0xf) = 0
2472050 waitid(0,-1,0x2b2aa70c,0xf) = 0
2472050 waitid(0,-1,0x2b2aa70c,0xf) = 0
2472050 waitid(0,-1,0x2b2aa70c,0xf) = 0
2472050 waitid(0,-1,0x2b2aa70c,0xf) = 0
2472050 waitid(0,-1,0x2b2aa70c,0xf) = 0
2472050 waitid(0,-1,0x2b2aa70c,0xf) = 0
2472050 waitid(0,-1,0x2b2aa70c,0xf) = 0
(...)

3)
pinacolada ~ # strace qemu-riscv32 -L /var/lib/machines/riscv32 /var/lib/machines/riscv32/bin/bash

(...)
write(2, "\33]0;root@pinacolada:~\7\33[01;31mpi"..., 58pinacolada ~ # ) = 58
pselect6(1, [0], NULL, NULL, NULL, {sigmask=[], sigsetsize=8}) = 1 (in [0])
read(0, "p", 1) = 1
pselect6(1, [0], NULL, [0], {tv_sec=0, tv_nsec=0}, NULL) = 0 (Timeout)
write(2, "p", 1p) = 1
pselect6(1, [0], NULL, NULL, NULL, {sigmask=[], sigsetsize=8}) = 1 (in [0])
read(0, "y", 1) = 1
pselect6(1, [0], NULL, [0], {tv_sec=0, tv_nsec=0}, NULL) = 0 (Timeout)
write(2, "y", 1y) = 1
pselect6(1, [0], NULL, NULL, NULL, {sigmask=[], sigsetsize=8}) = 1 (in [0])
read(0, "t", 1) = 1
pselect6(1, [0], NULL, [0], {tv_sec=0, tv_nsec=0}, NULL) = 0 (Timeout)
write(2, "t", 1t) = 1
pselect6(1, [0], NULL, NULL, NULL, {sigmask=[], sigsetsize=8}) = 1 (in [0])
read(0, "h", 1) = 1
pselect6(1, [0], NULL, [0], {tv_sec=0, tv_nsec=0}, NULL) = 0 (Timeout)
write(2, "h", 1h) = 1
pselect6(1, [0], NULL, NULL, NULL, {sigmask=[], sigsetsize=8}) = 1 (in [0])
read(0, "o", 1) = 1
pselect6(1, [0], NULL, [0], {tv_sec=0, tv_nsec=0}, NULL) = 0 (Timeout)
write(2, "o", 1o) = 1
pselect6(1, [0], NULL, NULL, NULL, {sigmask=[], sigsetsize=8}) = 1 (in [0])
read(0, "n", 1) = 1
pselect6(1, [0], NULL, [0], {tv_sec=0, tv_nsec=0}, NULL) = 0 (Timeout)
write(2, "n", 1n) = 1
pselect6(1, [0], NULL, NULL, NULL, {sigmask=[], sigsetsize=8}) = 1 (in [0])
read(0, "\r", 1) = 1
write(2, "\n", 1
) = 1
) = 904l\r", 9
ioctl(0, TCSETSW, {c_iflag=ICRNL|IXON|IXOFF|IUTF8, c_oflag=NL0|CR0|TAB0|BS0|VT0|FF0|OPOST|ONLCR, c_cflag=B38400|CS8|CREAD, c_lflag=ISIG|ICANON|ECHO|ECHOE|ECHOK|IEXTEN|ECHOCTL|ECHOKE, ...}) = 0 rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigaction(SIGINT, {sa_handler=0x4c2160, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x5cdb50}, NULL, 8) = 0 rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigaction(SIGHUP, {sa_handler=0x4c2160, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x5cdb50}, NULL, 8) = 0 rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigaction(SIGALRM, {sa_handler=0x4c2160, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x5cdb50}, NULL, 8) = 0 rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigaction(SIGWINCH, {sa_handler=0x4c2160, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_RESTART|SA_SIGINFO, sa_restorer=0x5cdb50}, NULL, 8) = 0 rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigaction(SIGINT, {sa_handler=0x4c2160, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x5cdb50}, NULL, 8) = 0 rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
statx(AT_FDCWD, ".", AT_STATX_SYNC_AS_STAT|AT_NO_AUTOMOUNT, STATX_BASIC_STATS, {stx_mask=STATX_BASIC_STATS|STATX_MNT_ID, stx_attributes=0, stx_mode=S_IFDIR|0700, stx_size=16384, ...}) = 0 statx(AT_FDCWD, "/usr/local/sbin/python", AT_STATX_SYNC_AS_STAT|AT_NO_AUTOMOUNT, STATX_BASIC_STATS, 0x7fff3f875900) = -1 ENOENT (No such file or directory) statx(AT_FDCWD, "/usr/local/bin/python", AT_STATX_SYNC_AS_STAT|AT_NO_AUTOMOUNT, STATX_BASIC_STATS, 0x7fff3f875900) = -1 ENOENT (No such file or directory) statx(AT_FDCWD, "/usr/sbin/python", AT_STATX_SYNC_AS_STAT|AT_NO_AUTOMOUNT, STATX_BASIC_STATS, 0x7fff3f875900) = -1 ENOENT (No such file or directory)

statx(AT_FDCWD, "/usr/bin/python", AT_STATX_SYNC_AS_STAT|AT_NO_AUTOMOUNT, STATX_BASIC_STATS, {stx_mask=STATX_BASIC_STATS|STATX_MNT_ID, stx_attributes=0, stx_mode=S_IFREG|0755, stx_size=18808, ...}) = 0
statx(AT_FDCWD, "/usr/bin/python", AT_STATX_SYNC_AS_STAT|AT_NO_AUTOMOUNT, STATX_BASIC_STATS, {stx_mask=STATX_BASIC_STATS|STATX_MNT_ID, stx_attributes=0, stx_mode=S_IFREG|0755, stx_size=18808, ...}) = 0
geteuid()                               = 0
getegid()                               = 0
getuid()                                = 0
getgid()                                = 0
faccessat2(AT_FDCWD, "/usr/bin/python", X_OK, 0) = 0
statx(AT_FDCWD, "/usr/bin/python", AT_STATX_SYNC_AS_STAT|AT_NO_AUTOMOUNT, STATX_BASIC_STATS, {stx_mask=STATX_BASIC_STATS|STATX_MNT_ID, stx_attributes=0, stx_mode=S_IFREG|0755, stx_size=18808, ...}) = 0
geteuid()                               = 0
getegid()                               = 0
getuid()                                = 0
getgid()                                = 0

faccessat2(AT_FDCWD, "/usr/bin/python", R_OK, 0) = 0
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, [INT TERM CHLD], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigaction(SIGTERM, {sa_handler=0x4c2160, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x5cdb50}, NULL, 8) = 0 rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, [INT TERM CHLD], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, [INT TERM CHLD], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, [INT TERM CHLD], NULL, 8) = 0
pipe2([3, 4], 0) = 0
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x228b790) = 2472081 rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, [INT TERM CHLD], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigaction(SIGTERM, {sa_handler=SIG_IGN, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x5cdb50}, NULL, 8) = 0 rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, [INT TERM CHLD], NULL, 8) = 0
setpgid(2472081, 2472081) = 0
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, [CHLD], NULL, 8) = 0

close(3)                                = 0
close(4)                                = 0
ioctl(255, TIOCGPGRP, [2472081])        = 0

rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0 rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0 rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0 rt_sigprocmask(SIG_SETMASK, [CHLD], NULL, 8) = 0
waitid(P_ALL, -1, Python 3.11.5 (main, Aug 27 2023, 18:39:05) [GCC 12.3.1 20230623] on linux Type "help", "copyright", "credits" or "license" for more information.

Quoted 1 line
Quoted 1 line
Quoted 1 line

{si_signo=SIGCHLD, si_code=CLD_STOPPED, si_pid=2472081, si_uid=0, si_status=SIGTSTP, si_utime=140734259223024 /* 1407342592230.24 s */, si_stime=4923637 /* 49236.37 s */}, WEXITED|WSTOPPED|WCONTINUED, NULL) = 0

rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, [CHLD], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, [CHLD], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, [CHLD], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, [CHLD], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, [CHLD TSTP TTIN TTOU], NULL, 8) = 0
ioctl(255, TIOCSPGRP, [2472076]) = 0
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, [CHLD], NULL, 8) = 0
ioctl(255, TCSETSW, {c_iflag=ICRNL|IXON|IXOFF|IUTF8, c_oflag=NL0|CR0|TAB0|BS0|VT0|FF0|OPOST|ONLCR, c_cflag=B38400|CS8|CREAD, c_lflag=ISIG|ICANON|ECHO|ECHOE|ECHOK|IEXTEN|ECHOCTL|ECHOKE, ...}) = 0 ioctl(255, TIOCGWINSZ, {ws_row=49, ws_col=194, ws_xpixel=1749, ws_ypixel=896}) = 0
write(2, "\n", 1
) = 1
futex(0x8800f8, FUTEX_WAKE_PRIVATE, 2147483647) = 0
readlink("/usr", 0x7fff3f8742a0, 1023) = -1 EINVAL (Invalid argument)
readlink("/usr/share", 0x7fff3f8742a0, 1023) = -1 EINVAL (Invalid argument)
readlink("/usr/share/locale", 0x7fff3f8742a0, 1023) = -1 EINVAL (Invalid argument)
readlink("/usr/share/locale/locale.alias", 0x7fff3f8742a0, 1023) = -1 EINVAL (Invalid argument)
access("/var/lib/machines/riscv32/usr/share/locale/locale.alias", F_OK) = 0
openat(AT_FDCWD, "/var/lib/machines/riscv32/usr/share/locale/locale.alias", O_RDONLY|O_CLOEXEC) = 3
statx(3, "", AT_STATX_SYNC_AS_STAT|AT_NO_AUTOMOUNT|AT_EMPTY_PATH, STATX_BASIC_STATS, {stx_mask=STATX_ALL|STATX_MNT_ID, stx_attributes=0, stx_mode=S_IFREG|0644, stx_size=2998, ...}) = 0 read(3, "# Locale name alias data base.\n#"..., 4096) = 2998

read(3, "", 4096)                       = 0
close(3)                                = 0
readlink("/usr", 0x7fff3f8742a0, 1023)  = -1 EINVAL (Invalid argument)

readlink("/usr/share", 0x7fff3f8742a0, 1023) = -1 EINVAL (Invalid argument)
readlink("/usr/share/locale", 0x7fff3f8742a0, 1023) = -1 EINVAL (Invalid argument) readlink("/usr/share/locale/en_US.utf8", 0x7fff3f8742a0, 1023) = -1 ENOENT (No such file or directory) access("/var/lib/machines/riscv32/usr/share/locale/en_US.utf8/LC_MESSAGES/bash.mo", F_OK) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/usr/share/locale/en_US.utf8/LC_MESSAGES/bash.mo", O_RDONLY) = -1 ENOENT (No such file or directory) readlink("/usr", 0x7fff3f8742a0, 1023) = -1 EINVAL (Invalid argument)
readlink("/usr/share", 0x7fff3f8742a0, 1023) = -1 EINVAL (Invalid argument)
readlink("/usr/share/locale", 0x7fff3f8742a0, 1023) = -1 EINVAL (Invalid argument) readlink("/usr/share/locale/en_US", 0x7fff3f8742a0, 1023) = -1 EINVAL (Invalid argument) readlink("/usr/share/locale/en_US/LC_MESSAGES", 0x7fff3f8742a0, 1023) = -1 EINVAL (Invalid argument) readlink("/usr/share/locale/en_US/LC_MESSAGES/bash.mo", 0x7fff3f8742a0, 1023) = -1 ENOENT (No such file or directory) access("/var/lib/machines/riscv32/usr/share/locale/en_US/LC_MESSAGES/bash.mo", F_OK) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/usr/share/locale/en_US/LC_MESSAGES/bash.mo", O_RDONLY) = -1 ENOENT (No such file or directory) readlink("/usr", 0x7fff3f8742a0, 1023) = -1 EINVAL (Invalid argument)
readlink("/usr/share", 0x7fff3f8742a0, 1023) = -1 EINVAL (Invalid argument)
readlink("/usr/share/locale", 0x7fff3f8742a0, 1023) = -1 EINVAL (Invalid argument) readlink("/usr/share/locale/en.utf8", 0x7fff3f8742a0, 1023) = -1 ENOENT (No such file or directory) access("/var/lib/machines/riscv32/usr/share/locale/en.utf8/LC_MESSAGES/bash.mo", F_OK) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/usr/share/locale/en.utf8/LC_MESSAGES/bash.mo", O_RDONLY) = -1 ENOENT (No such file or directory) readlink("/usr", 0x7fff3f8742a0, 1023) = -1 EINVAL (Invalid argument)
readlink("/usr/share", 0x7fff3f8742a0, 1023) = -1 EINVAL (Invalid argument)
readlink("/usr/share/locale", 0x7fff3f8742a0, 1023) = -1 EINVAL (Invalid argument)
readlink("/usr/share/locale/en", 0x7fff3f8742a0, 1023) = -1 EINVAL (Invalid argument) readlink("/usr/share/locale/en/LC_MESSAGES", 0x7fff3f8742a0, 1023) = -1 EINVAL (Invalid argument) readlink("/usr/share/locale/en/LC_MESSAGES/bash.mo", 0x7fff3f8742a0, 1023) = -1 ENOENT (No such file or directory) access("/var/lib/machines/riscv32/usr/share/locale/en/LC_MESSAGES/bash.mo", F_OK) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/usr/share/locale/en/LC_MESSAGES/bash.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
write(2, "[1]+ Stopped py"..., 37[1]+ Stopped python
) = 37
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_STOPPED, si_pid=2472081, si_uid=0, si_status=SIGTSTP, si_utime=2 /* 0.02 s */, si_stime=0} ---
rt_sigreturn({mask=~[BUS SEGV]}) = 0
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, [CHLD], NULL, 8) = 0

waitid(P_ALL, -1, {}, WNOHANG|WEXITED|WSTOPPED|WCONTINUED, NULL) = 0
waitid(P_ALL, -1, {}, WNOHANG|WEXITED|WSTOPPED|WCONTINUED, NULL) = 0
waitid(P_ALL, -1, {}, WNOHANG|WEXITED|WSTOPPED|WCONTINUED, NULL) = 0
waitid(P_ALL, -1, {}, WNOHANG|WEXITED|WSTOPPED|WCONTINUED, NULL) = 0
waitid(P_ALL, -1, {}, WNOHANG|WEXITED|WSTOPPED|WCONTINUED, NULL) = 0
waitid(P_ALL, -1, {}, WNOHANG|WEXITED|WSTOPPED|WCONTINUED, NULL) = 0
waitid(P_ALL, -1, {}, WNOHANG|WEXITED|WSTOPPED|WCONTINUED, NULL) = 0
waitid(P_ALL, -1, {}, WNOHANG|WEXITED|WSTOPPED|WCONTINUED, NULL) = 0
waitid(P_ALL, -1, {}, WNOHANG|WEXITED|WSTOPPED|WCONTINUED, NULL) = 0
waitid(P_ALL, -1, {}, WNOHANG|WEXITED|WSTOPPED|WCONTINUED, NULL) = 0
waitid(P_ALL, -1, {}, WNOHANG|WEXITED|WSTOPPED|WCONTINUED, NULL) = 0
waitid(P_ALL, -1, {}, WNOHANG|WEXITED|WSTOPPED|WCONTINUED, NULL) = 0
waitid(P_ALL, -1, {}, WNOHANG|WEXITED|WSTOPPED|WCONTINUED, NULL) = 0
waitid(P_ALL, -1, {}, WNOHANG|WEXITED|WSTOPPED|WCONTINUED, NULL) = 0
waitid(P_ALL, -1, {}, WNOHANG|WEXITED|WSTOPPED|WCONTINUED, NULL) = 0

(...)

Signature · 4 lines
Andreas K. Hüttel
[email protected]
Gentoo Linux developer
(council, toolchain, base-system, perl, libreoffice)
#8 lore raw
Quoted 381 lines · Andreas K. Huettel

Hi Alistair,

Quoted 2 lines

It would be great to get a strace of the failure to narrow down what it is. From there it should be not too hard to find and fix.

thanks a lot. Here's as much info as I could get with strace mechanisms.

1) What I did, without any tracing

pinacolada ~ # qemu-riscv32 -L /var/lib/machines/riscv32 /var/lib/machines/riscv32/bin/bash pinacolada ~ # python
Python 3.11.5 (main, Aug 27 2023, 18:39:05) [GCC 12.3.1 20230623] on linux Type "help", "copyright", "credits" or "license" for more information.

Quoted 1 line
Quoted 1 line
Quoted 1 line

[1]+ Stopped python
^C^C
pinacolada ~ # ^C
pinacolada ~ # fg
python

pinacolada ~ #
exit

* When I type Ctrl-Z at the python prompt, the terminal hangs.
* With several Ctrl-C I can get back to the riscv32 bash, and then python is suspended in the background.

* Now I did this again, first with qemu tracing system calls, then with strace tracing qemu
* In both cases, the log starts when I type "python", and ends (with quickly repeated output lines) after pressing Ctrl-Z

2)
pinacolada ~ # QEMU_STRACE=1 qemu-riscv32 -L /var/lib/machines/riscv32 /var/lib/machines/riscv32/bin/bash (QEMU_STRACE is getting unset in my bashrc, so no subprocesses are traced)

(...)
2472050 write(2,0xe56c0,58)pinacolada ~ # = 58
2472050 Unknown syscall 413
2472050 read(0,0x2b2aa29b,1) = 1
2472050 Unknown syscall 413
2472050 write(2,0xe56c0,1)p = 1
2472050 Unknown syscall 413
2472050 read(0,0x2b2aa29b,1) = 1
2472050 Unknown syscall 413
2472050 write(2,0xe56c0,1)y = 1
2472050 Unknown syscall 413
2472050 read(0,0x2b2aa29b,1) = 1
2472050 Unknown syscall 413
2472050 write(2,0xe56c0,1)t = 1
2472050 Unknown syscall 413
2472050 read(0,0x2b2aa29b,1) = 1
2472050 Unknown syscall 413
2472050 write(2,0xe56c0,1)h = 1
2472050 Unknown syscall 413
2472050 read(0,0x2b2aa29b,1) = 1
2472050 Unknown syscall 413
2472050 write(2,0xe56c0,1)o = 1
2472050 Unknown syscall 413
2472050 read(0,0x2b2aa29b,1) = 1
2472050 Unknown syscall 413
2472050 write(2,0xe56c0,1)n = 1
2472050 Unknown syscall 413
2472050 read(0,0x2b2aa29b,1) = 1
2472050 write(2,0xe56c0,1)
= 1
= 9050 write(2,0xe56c0,9)
2472050 ioctl(0,TCSETSW,{c_iflag = ICRNL|IXON|IXOFF|IUTF8,c_oflag = OPOST|ONLCR,c_cflag = B38400,CS8,CREAD,c_lflag = ISIG|ICANON|ECHO|ECHOE|ECHOK|ECHOCTL|ECHOKE|IEXTEN,c_cc = "",c_line = ''}) = 0 2472050 rt_sigaction(SIGINT,0x2b2aa1bc,0x2b2aa244) = 0
2472050 rt_sigaction(SIGHUP,0x2b2aa1bc,0x2b2aa244) = 0
2472050 rt_sigaction(SIGALRM,0x2b2aa1bc,0x2b2aa244) = 0
2472050 rt_sigaction(SIGWINCH,0x2b2aa1bc,0x2b2aa244) = 0
2472050 rt_sigaction(SIGINT,0x2b2aa14c,0x2b2aa1d4) = 0
2472050 clock_gettime64(CLOCK_REALTIME_COARSE,0x2b2aa268) = 0 ({tv_sec=1695154794,tv_nsec=760883171})
2472050 statx(AT_FDCWD,".",AT_NO_AUTOMOUNT|AT_STATX_SYNC_AS_STAT,STATX_BASIC_STATS,0x2b2aaa78) = 0
2472050 statx(AT_FDCWD,"/usr/local/sbin/python",AT_NO_AUTOMOUNT|AT_STATX_SYNC_AS_STAT,STATX_BASIC_STATS,0x2b2aa998) = -1 errno=2 (No such file or directory) 2472050 statx(AT_FDCWD,"/usr/local/bin/python",AT_NO_AUTOMOUNT|AT_STATX_SYNC_AS_STAT,STATX_BASIC_STATS,0x2b2aa998) = -1 errno=2 (No such file or directory)
2472050 statx(AT_FDCWD,"/usr/sbin/python",AT_NO_AUTOMOUNT|AT_STATX_SYNC_AS_STAT,STATX_BASIC_STATS,0x2b2aa998) = -1 errno=2 (No such file or directory)
2472050 statx(AT_FDCWD,"/usr/bin/python",AT_NO_AUTOMOUNT|AT_STATX_SYNC_AS_STAT,STATX_BASIC_STATS,0x2b2aa998) = 0
2472050 statx(AT_FDCWD,"/usr/bin/python",AT_NO_AUTOMOUNT|AT_STATX_SYNC_AS_STAT,STATX_BASIC_STATS,0x2b2aa8e8) = 0
2472050 geteuid() = 0
2472050 getegid() = 0
2472050 getuid() = 0
2472050 getgid() = 0
2472050 faccessat(AT_FDCWD,"/usr/bin/python",X_OK,AT_SYMLINK_NOFOLLOW|0x1da42089) = 0
2472050 statx(AT_FDCWD,"/usr/bin/python",AT_NO_AUTOMOUNT|AT_STATX_SYNC_AS_STAT,STATX_BASIC_STATS,0x2b2aa8e8) = 0
2472050 geteuid() = 0
2472050 getegid() = 0
2472050 getuid() = 0
2472050 getgid() = 0
2472050 faccessat(AT_FDCWD,"/usr/bin/python",R_OK,AT_SYMLINK_NOFOLLOW|0x1da42089) = 0
2472050 rt_sigprocmask(SIG_BLOCK,NULL,0x2b2aabec,8) = 0
2472050 rt_sigprocmask(SIG_BLOCK,0x2b2aaaec,0x2b2aab6c,8) = 0
2472050 rt_sigaction(SIGTERM,0x2b2aa85c,0x2b2aa8e4) = 0
2472050 rt_sigprocmask(SIG_BLOCK,0x2b2aa98c,0x2b2aaa0c,8) = 0
2472050 rt_sigprocmask(SIG_SETMASK,0x2b2aaa0c,NULL,8) = 0
2472050 pipe2(0x5560d3f4,0) = 0
2472050 clone(CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|0x11,child_stack=0x00000000,parent_tidptr=0x00000000,tls=0x00000000,child_tidptr=0x2b2d20c8) = 2472055 2472050 rt_sigaction(SIGTERM,0x2b2aa85c,0x2b2aa8e4) = 0
= 0
2472050 setpgid(2472055,2472055) = 0
2472055 set_robust_list(0x2b2d20cc,12) = 2472050 rt_sigprocmask(SIG_SETMASK,0x2b2aab6c,-1 errno=38 (Function not implemented)NULL,
8) = 0
2472055 getpid() = 2472055
2472055 rt_sigprocmask(SIG_SETMASK,0x55616e24,NULL,8) = 0
2472050 rt_sigprocmask(SIG_BLOCK,0x2b2aaaac,0x2b2aab2c,8) = 0
2472050 close(3) = 0
2472050 close(4) = 0
2472055 rt_sigaction(SIGTSTP,0x2b2aa84c,0x2b2aa8d4) = 0
2472055 rt_sigaction(SIGTTIN,0x2b2aa84c,0x2b2aa8d4) = 0
2472055 rt_sigaction(SIGTTOU,0x2b2aa85c,0x2b2aa8e4) = 0
2472055 setpgid(2472055,2472055) = 0
2472055 rt_sigprocmask(SIG_BLOCK,0x2b2aa99c,0x2b2aaa1c,8) = 0
2472055 ioctl(255,TIOCSPGRP,2472055) = 0
2472055 rt_sigprocmask(SIG_SETMASK,0x2b2aaa1c,NULL,8) = 0
2472050 ioctl(255,TIOCGPGRP,0x2b2aaa78) = 0 (2472055)2472055
close(4) = 0
2472050 rt_sigprocmask(SIG_SETMASK,0x2b2aab2c,NULL,2472055 8)read(3,0x2b2aaaeb,1) = 0 =
0
2472055 close(3) = 0
2472050 rt_sigprocmask(SIG_BLOCK,0x2b2aabac,0x2b2aac2c,8) = 0
2472055 rt_sigaction(SIGHUP,0x2b2aaacc,NULL) = 0
2472055 rt_sigaction(SIGILL,0x2b2aaacc,NULL) = 0
2472055 rt_sigaction(SIGTRAP,0x2b2aaacc,NULL) = 0
2472055 rt_sigaction(SIGIOT,0x2b2aaacc,NULL) = 0
2472055 rt_sigaction(SIGFPE,0x2b2aaacc,NULL) = 0
2472055 rt_sigaction(SIGBUS,0x2b2aaacc,NULL) = 0
2472055 rt_sigaction(SIGSEGV,0x2b2aaacc,NULL) = 0
2472055 rt_sigaction(SIGSYS,0x2b2aaacc,NULL) = 0
2472055 rt_sigaction(SIGPIPE,0x2b2aaacc,NULL) = 0
2472050 2472055 waitid(0,-1,0x2b2aaa7c,0xe)rt_sigaction(SIGALRM,0x2b2aaacc,NULL) = 0
2472055 rt_sigaction(SIGXCPU,0x2b2aaacc,NULL) = 0
2472055 rt_sigaction(SIGXFSZ,0x2b2aaacc,NULL) = 0
2472055 rt_sigaction(SIGVTALRM,0x2b2aaacc,NULL) = 0
2472055 rt_sigaction(SIGUSR1,0x2b2aaacc,NULL) = 0
2472055 rt_sigaction(SIGUSR2,0x2b2aaacc,NULL) = 0
2472055 rt_sigaction(SIGINT,0x2b2aaa0c,0x2b2aaa94) = 0
2472055 rt_sigaction(SIGQUIT,0x2b2aaa0c,0x2b2aaa94) = 0
2472055 rt_sigaction(SIGTERM,0x2b2aaa0c,0x2b2aaa94) = 0
2472055 rt_sigaction(SIGCHLD,0x2b2aaa0c,0x2b2aaa94) = 0
2472055 execve("/usr/bin/python",{"python",NULL})Python 3.11.5 (main, Aug 27 2023, 18:39:05) [GCC 12.3.1 20230623] on linux
Type "help", "copyright", "credits" or "license" for more information.

Quoted 1 line
Quoted 1 line
Quoted 1 line

= 0

2472050 rt_sigprocmask(SIG_BLOCK,0x2b2aa9ec,0x2b2aaa6c,8) = 0
2472050 rt_sigprocmask(SIG_SETMASK,0x2b2aaa6c,NULL,8) = 0
2472050 rt_sigprocmask(SIG_BLOCK,0x2b2aa9ec,0x2b2aaa6c,8) = 0
2472050 rt_sigprocmask(SIG_SETMASK,0x2b2aaa6c,NULL,8) = 0
2472050 rt_sigprocmask(SIG_BLOCK,0x2b2aaa6c,0x2b2aaaec,8) = 0
2472050 ioctl(255,TIOCSPGRP,2472050) = 0
2472050 rt_sigprocmask(SIG_SETMASK,0x2b2aaaec,NULL,8) = 0
2472050 ioctl(255,TCSETSW,{c_iflag = ICRNL|IXON|IXOFF|IUTF8,c_oflag = OPOST|ONLCR,c_cflag = B38400,CS8,CREAD,c_lflag = ISIG|ICANON|ECHO|ECHOE|ECHOK|ECHOCTL|ECHOKE|IEXTEN,c_cc = "",c_line = ''}) = 0 2472050 ioctl(255,TIOCGWINSZ,0x2b2aab74) = 0 ({49,194,1749,896})
2472050 write(2,0xe56c0,1)
= 1
2472050 openat(AT_FDCWD,"/usr/share/locale/locale.alias",O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
2472050 statx(3,"",AT_EMPTY_PATH|AT_NO_AUTOMOUNT|AT_STATX_SYNC_AS_STAT,STATX_BASIC_STATS,0x2b2aa3b8) = 0
2472050 read(3,0xf4d00,4096) = 2998
2472050 read(3,0xf4d00,4096) = 0
2472050 close(3) = 0
2472050 openat(AT_FDCWD,"/usr/share/locale/en_US.utf8/LC_MESSAGES/bash.mo",O_RDONLY|O_LARGEFILE) = -1 errno=2 (No such file or directory)
2472050 openat(AT_FDCWD,"/usr/share/locale/en_US/LC_MESSAGES/bash.mo",O_RDONLY|O_LARGEFILE) = -1 errno=2 (No such file or directory)
2472050 openat(AT_FDCWD,"/usr/share/locale/en.utf8/LC_MESSAGES/bash.mo",O_RDONLY|O_LARGEFILE) = -1 errno=2 (No such file or directory)
2472050 openat(AT_FDCWD,"/usr/share/locale/en/LC_MESSAGES/bash.mo",O_RDONLY|O_LARGEFILE) = -1 errno=2 (No such file or directory)
2472050 write(2,0xe56c0,37)[1]+ Stopped python
= 37
2472050 rt_sigprocmask(SIG_SETMASK,0x2b2aac2c,NULL,8) = 0
--- SIGCHLD {si_signo=SIGCHLD, si_code=5, si_pid=2472055, si_uid=0, si_status=20, si_utime=2, si_stime=0} ---
2472050 waitid(0,-1,0x2b2aa70c,0xf) = 0
2472050 waitid(0,-1,0x2b2aa70c,0xf) = 0
2472050 waitid(0,-1,0x2b2aa70c,0xf) = 0
2472050 waitid(0,-1,0x2b2aa70c,0xf) = 0
2472050 waitid(0,-1,0x2b2aa70c,0xf) = 0
2472050 waitid(0,-1,0x2b2aa70c,0xf) = 0
2472050 waitid(0,-1,0x2b2aa70c,0xf) = 0
2472050 waitid(0,-1,0x2b2aa70c,0xf) = 0
2472050 waitid(0,-1,0x2b2aa70c,0xf) = 0
2472050 waitid(0,-1,0x2b2aa70c,0xf) = 0
2472050 waitid(0,-1,0x2b2aa70c,0xf) = 0
2472050 waitid(0,-1,0x2b2aa70c,0xf) = 0
2472050 waitid(0,-1,0x2b2aa70c,0xf) = 0
2472050 waitid(0,-1,0x2b2aa70c,0xf) = 0
(...)

3)
pinacolada ~ # strace qemu-riscv32 -L /var/lib/machines/riscv32 /var/lib/machines/riscv32/bin/bash

(...)
write(2, "\33]0;root@pinacolada:~\7\33[01;31mpi"..., 58pinacolada ~ # ) = 58
pselect6(1, [0], NULL, NULL, NULL, {sigmask=[], sigsetsize=8}) = 1 (in [0])
read(0, "p", 1) = 1
pselect6(1, [0], NULL, [0], {tv_sec=0, tv_nsec=0}, NULL) = 0 (Timeout)
write(2, "p", 1p) = 1
pselect6(1, [0], NULL, NULL, NULL, {sigmask=[], sigsetsize=8}) = 1 (in [0])
read(0, "y", 1) = 1
pselect6(1, [0], NULL, [0], {tv_sec=0, tv_nsec=0}, NULL) = 0 (Timeout)
write(2, "y", 1y) = 1
pselect6(1, [0], NULL, NULL, NULL, {sigmask=[], sigsetsize=8}) = 1 (in [0])
read(0, "t", 1) = 1
pselect6(1, [0], NULL, [0], {tv_sec=0, tv_nsec=0}, NULL) = 0 (Timeout)
write(2, "t", 1t) = 1
pselect6(1, [0], NULL, NULL, NULL, {sigmask=[], sigsetsize=8}) = 1 (in [0])
read(0, "h", 1) = 1
pselect6(1, [0], NULL, [0], {tv_sec=0, tv_nsec=0}, NULL) = 0 (Timeout)
write(2, "h", 1h) = 1
pselect6(1, [0], NULL, NULL, NULL, {sigmask=[], sigsetsize=8}) = 1 (in [0])
read(0, "o", 1) = 1
pselect6(1, [0], NULL, [0], {tv_sec=0, tv_nsec=0}, NULL) = 0 (Timeout)
write(2, "o", 1o) = 1
pselect6(1, [0], NULL, NULL, NULL, {sigmask=[], sigsetsize=8}) = 1 (in [0])
read(0, "n", 1) = 1
pselect6(1, [0], NULL, [0], {tv_sec=0, tv_nsec=0}, NULL) = 0 (Timeout)
write(2, "n", 1n) = 1
pselect6(1, [0], NULL, NULL, NULL, {sigmask=[], sigsetsize=8}) = 1 (in [0])
read(0, "\r", 1) = 1
write(2, "\n", 1
) = 1
) = 904l\r", 9
ioctl(0, TCSETSW, {c_iflag=ICRNL|IXON|IXOFF|IUTF8, c_oflag=NL0|CR0|TAB0|BS0|VT0|FF0|OPOST|ONLCR, c_cflag=B38400|CS8|CREAD, c_lflag=ISIG|ICANON|ECHO|ECHOE|ECHOK|IEXTEN|ECHOCTL|ECHOKE, ...}) = 0 rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigaction(SIGINT, {sa_handler=0x4c2160, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x5cdb50}, NULL, 8) = 0 rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigaction(SIGHUP, {sa_handler=0x4c2160, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x5cdb50}, NULL, 8) = 0 rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigaction(SIGALRM, {sa_handler=0x4c2160, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x5cdb50}, NULL, 8) = 0 rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigaction(SIGWINCH, {sa_handler=0x4c2160, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_RESTART|SA_SIGINFO, sa_restorer=0x5cdb50}, NULL, 8) = 0 rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigaction(SIGINT, {sa_handler=0x4c2160, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x5cdb50}, NULL, 8) = 0 rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
statx(AT_FDCWD, ".", AT_STATX_SYNC_AS_STAT|AT_NO_AUTOMOUNT, STATX_BASIC_STATS, {stx_mask=STATX_BASIC_STATS|STATX_MNT_ID, stx_attributes=0, stx_mode=S_IFDIR|0700, stx_size=16384, ...}) = 0 statx(AT_FDCWD, "/usr/local/sbin/python", AT_STATX_SYNC_AS_STAT|AT_NO_AUTOMOUNT, STATX_BASIC_STATS, 0x7fff3f875900) = -1 ENOENT (No such file or directory) statx(AT_FDCWD, "/usr/local/bin/python", AT_STATX_SYNC_AS_STAT|AT_NO_AUTOMOUNT, STATX_BASIC_STATS, 0x7fff3f875900) = -1 ENOENT (No such file or directory) statx(AT_FDCWD, "/usr/sbin/python", AT_STATX_SYNC_AS_STAT|AT_NO_AUTOMOUNT, STATX_BASIC_STATS, 0x7fff3f875900) = -1 ENOENT (No such file or directory)

statx(AT_FDCWD, "/usr/bin/python", AT_STATX_SYNC_AS_STAT|AT_NO_AUTOMOUNT, STATX_BASIC_STATS, {stx_mask=STATX_BASIC_STATS|STATX_MNT_ID, stx_attributes=0, stx_mode=S_IFREG|0755, stx_size=18808, ...}) = 0
statx(AT_FDCWD, "/usr/bin/python", AT_STATX_SYNC_AS_STAT|AT_NO_AUTOMOUNT, STATX_BASIC_STATS, {stx_mask=STATX_BASIC_STATS|STATX_MNT_ID, stx_attributes=0, stx_mode=S_IFREG|0755, stx_size=18808, ...}) = 0
geteuid()                               = 0
getegid()                               = 0
getuid()                                = 0
getgid()                                = 0
faccessat2(AT_FDCWD, "/usr/bin/python", X_OK, 0) = 0
statx(AT_FDCWD, "/usr/bin/python", AT_STATX_SYNC_AS_STAT|AT_NO_AUTOMOUNT, STATX_BASIC_STATS, {stx_mask=STATX_BASIC_STATS|STATX_MNT_ID, stx_attributes=0, stx_mode=S_IFREG|0755, stx_size=18808, ...}) = 0
geteuid()                               = 0
getegid()                               = 0
getuid()                                = 0
getgid()                                = 0

faccessat2(AT_FDCWD, "/usr/bin/python", R_OK, 0) = 0
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, [INT TERM CHLD], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigaction(SIGTERM, {sa_handler=0x4c2160, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x5cdb50}, NULL, 8) = 0 rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, [INT TERM CHLD], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, [INT TERM CHLD], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, [INT TERM CHLD], NULL, 8) = 0
pipe2([3, 4], 0) = 0
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x228b790) = 2472081 rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, [INT TERM CHLD], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigaction(SIGTERM, {sa_handler=SIG_IGN, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x5cdb50}, NULL, 8) = 0 rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, [INT TERM CHLD], NULL, 8) = 0
setpgid(2472081, 2472081) = 0
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, [CHLD], NULL, 8) = 0

close(3)                                = 0
close(4)                                = 0
ioctl(255, TIOCGPGRP, [2472081])        = 0

rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0 rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0 rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0 rt_sigprocmask(SIG_SETMASK, [CHLD], NULL, 8) = 0
waitid(P_ALL, -1, Python 3.11.5 (main, Aug 27 2023, 18:39:05) [GCC 12.3.1 20230623] on linux Type "help", "copyright", "credits" or "license" for more information.

Quoted 1 line
Quoted 1 line
Quoted 1 line

{si_signo=SIGCHLD, si_code=CLD_STOPPED, si_pid=2472081, si_uid=0, si_status=SIGTSTP, si_utime=140734259223024 /* 1407342592230.24 s */, si_stime=4923637 /* 49236.37 s */}, WEXITED|WSTOPPED|WCONTINUED, NULL) = 0

rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, [CHLD], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, [CHLD], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, [CHLD], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, [CHLD], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, [CHLD TSTP TTIN TTOU], NULL, 8) = 0
ioctl(255, TIOCSPGRP, [2472076]) = 0
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, [CHLD], NULL, 8) = 0
ioctl(255, TCSETSW, {c_iflag=ICRNL|IXON|IXOFF|IUTF8, c_oflag=NL0|CR0|TAB0|BS0|VT0|FF0|OPOST|ONLCR, c_cflag=B38400|CS8|CREAD, c_lflag=ISIG|ICANON|ECHO|ECHOE|ECHOK|IEXTEN|ECHOCTL|ECHOKE, ...}) = 0 ioctl(255, TIOCGWINSZ, {ws_row=49, ws_col=194, ws_xpixel=1749, ws_ypixel=896}) = 0
write(2, "\n", 1
) = 1
futex(0x8800f8, FUTEX_WAKE_PRIVATE, 2147483647) = 0
readlink("/usr", 0x7fff3f8742a0, 1023) = -1 EINVAL (Invalid argument)
readlink("/usr/share", 0x7fff3f8742a0, 1023) = -1 EINVAL (Invalid argument)
readlink("/usr/share/locale", 0x7fff3f8742a0, 1023) = -1 EINVAL (Invalid argument)
readlink("/usr/share/locale/locale.alias", 0x7fff3f8742a0, 1023) = -1 EINVAL (Invalid argument)
access("/var/lib/machines/riscv32/usr/share/locale/locale.alias", F_OK) = 0
openat(AT_FDCWD, "/var/lib/machines/riscv32/usr/share/locale/locale.alias", O_RDONLY|O_CLOEXEC) = 3
statx(3, "", AT_STATX_SYNC_AS_STAT|AT_NO_AUTOMOUNT|AT_EMPTY_PATH, STATX_BASIC_STATS, {stx_mask=STATX_ALL|STATX_MNT_ID, stx_attributes=0, stx_mode=S_IFREG|0644, stx_size=2998, ...}) = 0 read(3, "# Locale name alias data base.\n#"..., 4096) = 2998

read(3, "", 4096)                       = 0
close(3)                                = 0
readlink("/usr", 0x7fff3f8742a0, 1023)  = -1 EINVAL (Invalid argument)

readlink("/usr/share", 0x7fff3f8742a0, 1023) = -1 EINVAL (Invalid argument)
readlink("/usr/share/locale", 0x7fff3f8742a0, 1023) = -1 EINVAL (Invalid argument) readlink("/usr/share/locale/en_US.utf8", 0x7fff3f8742a0, 1023) = -1 ENOENT (No such file or directory) access("/var/lib/machines/riscv32/usr/share/locale/en_US.utf8/LC_MESSAGES/bash.mo", F_OK) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/usr/share/locale/en_US.utf8/LC_MESSAGES/bash.mo", O_RDONLY) = -1 ENOENT (No such file or directory) readlink("/usr", 0x7fff3f8742a0, 1023) = -1 EINVAL (Invalid argument)
readlink("/usr/share", 0x7fff3f8742a0, 1023) = -1 EINVAL (Invalid argument)
readlink("/usr/share/locale", 0x7fff3f8742a0, 1023) = -1 EINVAL (Invalid argument) readlink("/usr/share/locale/en_US", 0x7fff3f8742a0, 1023) = -1 EINVAL (Invalid argument) readlink("/usr/share/locale/en_US/LC_MESSAGES", 0x7fff3f8742a0, 1023) = -1 EINVAL (Invalid argument) readlink("/usr/share/locale/en_US/LC_MESSAGES/bash.mo", 0x7fff3f8742a0, 1023) = -1 ENOENT (No such file or directory) access("/var/lib/machines/riscv32/usr/share/locale/en_US/LC_MESSAGES/bash.mo", F_OK) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/usr/share/locale/en_US/LC_MESSAGES/bash.mo", O_RDONLY) = -1 ENOENT (No such file or directory) readlink("/usr", 0x7fff3f8742a0, 1023) = -1 EINVAL (Invalid argument)
readlink("/usr/share", 0x7fff3f8742a0, 1023) = -1 EINVAL (Invalid argument)
readlink("/usr/share/locale", 0x7fff3f8742a0, 1023) = -1 EINVAL (Invalid argument) readlink("/usr/share/locale/en.utf8", 0x7fff3f8742a0, 1023) = -1 ENOENT (No such file or directory) access("/var/lib/machines/riscv32/usr/share/locale/en.utf8/LC_MESSAGES/bash.mo", F_OK) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/usr/share/locale/en.utf8/LC_MESSAGES/bash.mo", O_RDONLY) = -1 ENOENT (No such file or directory) readlink("/usr", 0x7fff3f8742a0, 1023) = -1 EINVAL (Invalid argument)
readlink("/usr/share", 0x7fff3f8742a0, 1023) = -1 EINVAL (Invalid argument)
readlink("/usr/share/locale", 0x7fff3f8742a0, 1023) = -1 EINVAL (Invalid argument)
readlink("/usr/share/locale/en", 0x7fff3f8742a0, 1023) = -1 EINVAL (Invalid argument) readlink("/usr/share/locale/en/LC_MESSAGES", 0x7fff3f8742a0, 1023) = -1 EINVAL (Invalid argument) readlink("/usr/share/locale/en/LC_MESSAGES/bash.mo", 0x7fff3f8742a0, 1023) = -1 ENOENT (No such file or directory) access("/var/lib/machines/riscv32/usr/share/locale/en/LC_MESSAGES/bash.mo", F_OK) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/usr/share/locale/en/LC_MESSAGES/bash.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
write(2, "[1]+ Stopped py"..., 37[1]+ Stopped python
) = 37
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_STOPPED, si_pid=2472081, si_uid=0, si_status=SIGTSTP, si_utime=2 /* 0.02 s */, si_stime=0} ---
rt_sigreturn({mask=~[BUS SEGV]}) = 0
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, [CHLD], NULL, 8) = 0

waitid(P_ALL, -1, {}, WNOHANG|WEXITED|WSTOPPED|WCONTINUED, NULL) = 0
waitid(P_ALL, -1, {}, WNOHANG|WEXITED|WSTOPPED|WCONTINUED, NULL) = 0
waitid(P_ALL, -1, {}, WNOHANG|WEXITED|WSTOPPED|WCONTINUED, NULL) = 0
waitid(P_ALL, -1, {}, WNOHANG|WEXITED|WSTOPPED|WCONTINUED, NULL) = 0
waitid(P_ALL, -1, {}, WNOHANG|WEXITED|WSTOPPED|WCONTINUED, NULL) = 0
waitid(P_ALL, -1, {}, WNOHANG|WEXITED|WSTOPPED|WCONTINUED, NULL) = 0
waitid(P_ALL, -1, {}, WNOHANG|WEXITED|WSTOPPED|WCONTINUED, NULL) = 0
waitid(P_ALL, -1, {}, WNOHANG|WEXITED|WSTOPPED|WCONTINUED, NULL) = 0
waitid(P_ALL, -1, {}, WNOHANG|WEXITED|WSTOPPED|WCONTINUED, NULL) = 0
waitid(P_ALL, -1, {}, WNOHANG|WEXITED|WSTOPPED|WCONTINUED, NULL) = 0
waitid(P_ALL, -1, {}, WNOHANG|WEXITED|WSTOPPED|WCONTINUED, NULL) = 0
waitid(P_ALL, -1, {}, WNOHANG|WEXITED|WSTOPPED|WCONTINUED, NULL) = 0
waitid(P_ALL, -1, {}, WNOHANG|WEXITED|WSTOPPED|WCONTINUED, NULL) = 0
waitid(P_ALL, -1, {}, WNOHANG|WEXITED|WSTOPPED|WCONTINUED, NULL) = 0
waitid(P_ALL, -1, {}, WNOHANG|WEXITED|WSTOPPED|WCONTINUED, NULL) = 0
Quoted 1 line

(...)

Ok!

So on my x86 machine I see this

--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=285545, si_uid=1000, si_status=0, si_utime=0, si_stime=0} --- wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], WNOHANG|WSTOPPED|WCONTINUED, NULL) = 285545
wait4(-1, 0x7ffe3eeb8210, WNOHANG|WSTOPPED|WCONTINUED, NULL) = 0
rt_sigreturn({mask=[INT]}) = 0
close(3) = 0

It all looks ok.

Maybe the host_to_target_siginfo() function in QEMU is the issue? Something in here?
https://github.com/qemu/qemu/blob/master/linux-user/signal.c#L335

Nothing jumps out with a quick look though

Alistair

Quoted 8 lines

--
Andreas K. Hüttel
[email protected]
Gentoo Linux developer
(council, toolchain, base-system, perl, libreoffice)

author Tested-by Alex Fan Reviewed-by Philippe Mathieu-Daudé
#9 lore raw

Hi Alistair,

Quoted 13 lines

Ok!

So on my x86 machine I see this

--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=285545, si_uid=1000, si_status=0, si_utime=0, si_stime=0} --- wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], WNOHANG|WSTOPPED|WCONTINUED, NULL) = 285545
wait4(-1, 0x7ffe3eeb8210, WNOHANG|WSTOPPED|WCONTINUED, NULL) = 0
rt_sigreturn({mask=[INT]}) = 0
close(3) = 0

Quoted 1 line

It all looks ok.

This was fixed in the meantime (hooray!), sorry I didn't think anyone would still look at the old thread. The commit is given below.

Since then we've been able to build riscv32 stages for Gentoo just fine using qemu-user, see
https://www.gentoo.org/downloads/#riscv

Cheers,
Andreas

commit f0907ff4cae743f1a4ef3d0a55a047029eed06ff

Author:     Richard Henderson <[email protected]>
AuthorDate: Fri Apr 5 11:58:14 2024 -1000
Commit:     Richard Henderson <[email protected]>
CommitDate: Tue Apr 9 07:43:11 2024 -1000

linux-user: Fix waitid return of siginfo_t and rusage

The copy back to siginfo_t should be conditional only on arg3, not the specific values that might have been written. The copy back to rusage was missing entirely.

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

Quoted 18 lines

Maybe the host_to_target_siginfo() function in QEMU is the issue? Something in here?
https://github.com/qemu/qemu/blob/master/linux-user/signal.c#L335

Nothing jumps out with a quick look though

Alistair

Quoted 8 lines

--
Andreas K. Hüttel
[email protected]
Gentoo Linux developer
(council, toolchain, base-system, perl, libreoffice)

Signature · 4 lines
Andreas K. Hüttel
[email protected]
Gentoo Linux developer
(council, toolchain, base-system, perl, libreoffice)
#10 lore raw
Quoted 16 lines · Andreas K. Huettel

Hi Alistair,

Quoted 13 lines

Ok!

So on my x86 machine I see this

--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=285545, si_uid=1000, si_status=0, si_utime=0, si_stime=0} --- wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], WNOHANG|WSTOPPED|WCONTINUED, NULL) = 285545
wait4(-1, 0x7ffe3eeb8210, WNOHANG|WSTOPPED|WCONTINUED, NULL) = 0
rt_sigreturn({mask=[INT]}) = 0
close(3) = 0

Quoted 8 lines
Quoted 1 line

It all looks ok.

This was fixed in the meantime (hooray!), sorry I didn't think anyone would still look at the old thread. The commit is given below.

Since then we've been able to build riscv32 stages for Gentoo just fine using qemu-user, see
https://www.gentoo.org/downloads/#riscv

Great!

Alistair

Quoted 48 lines

Cheers,
Andreas

commit f0907ff4cae743f1a4ef3d0a55a047029eed06ff

Author:     Richard Henderson <[email protected]>
AuthorDate: Fri Apr 5 11:58:14 2024 -1000
Commit:     Richard Henderson <[email protected]>
CommitDate: Tue Apr 9 07:43:11 2024 -1000

linux-user: Fix waitid return of siginfo_t and rusage

The copy back to siginfo_t should be conditional only on arg3, not the specific values that might have been written. The copy back to rusage was missing entirely.

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

Quoted 18 lines

Maybe the host_to_target_siginfo() function in QEMU is the issue? Something in here?
https://github.com/qemu/qemu/blob/master/linux-user/signal.c#L335

Nothing jumps out with a quick look though

Alistair

Quoted 8 lines

--
Andreas K. Hüttel
[email protected]
Gentoo Linux developer
(council, toolchain, base-system, perl, libreoffice)

--
Andreas K. Hüttel
[email protected]
Gentoo Linux developer
(council, toolchain, base-system, perl, libreoffice)