ptitSeb / box64

Box64 - Linux Userspace x86_64 Emulator with a twist, targeted at ARM64 Linux devices

Home Page:https://box86.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Infinite loop over "shm_semaphores_init: semctl init error: Invalid argument " (termux / proot)

pierreduf opened this issue · comments

Hello,

I try to run a program and after the initial loading step, it stays in a loop with error "shm_semaphores_init: semctl init error: Invalid argument "

I'm in a proot environment in termux : proot was mentioned as a problem with that exact error in only one ticket : #754 but it seems completely unrelated.

I've built my own box64 on android (proot in termux) with DYNAREC and BAD_SIGNAL. I've tried with a pre-built box64-android but same problem.

I've got 2 questions:

1/ Could you explain what this error means and what could the cause ?
2/ Is there any way to circumvent it ?

With debug level 2, I've got a bit more details:

0x3f0217d6f3: Calling semget(0x4D31727E, 0x8, 0x780, ...) => return 0x811001 
0x3f0217d71a: Calling semctl(0x811001, 0x0, 0x11, ...) => return 0xFFFFFFFFFFFFFFFF 
0x3f0217d729: Calling __errno_location(0x811001, 0x0, 0x11, ...) => return 0x7DC6E2CA10 
0x3f0217d730: Calling strerror(0x16, 0x0, 0x11, ...) => return 0x7DC6DC0200 
0x3f02190547: Calling vasprintf(0x7DC6B67FA8, 0x3F0223C60A, 0x7DC6B67FD8, ...) => return 0x47 
0x3f021903cd: Calling vprintf(0x3F0223ED78, 0x7DC6B67EC8, 0x3F021B2196, ...) =>shm_semaphores_init: semctl init error: Invalid argument - trying again return 0x48 
0x3f0219057d: Calling free(0x369E9EA0, 0x7DC6B67EC8, 0x3F021B2196, ...) => return 0x48 
0x3f0217d763: Calling semctl(0x811001, 0x0, 0x0, ...) => return 0x0 
0x3f0217d6f3: Calling semget(0x4D31727E, 0x8, 0x780, ...) => return 0x812001 
0x3f0217d71a: Calling semctl(0x812001, 0x0, 0x11, ...) => return 0xFFFFFFFFFFFFFFFF 
0x3f0217d729: Calling __errno_location(0x812001, 0x0, 0x11, ...) => return 0x7DC6E2CA10 
0x3f0217d730: Calling strerror(0x16, 0x0, 0x11, ...) => return 0x7DC6DC0200 
0x3f02190547: Calling vasprintf(0x7DC6B67FA8, 0x3F0223C60A, 0x7DC6B67FD8, ...) => return 0x47 
0x3f021903cd: Calling vprintf(0x3F0223ED78, 0x7DC6B67EC8, 0x3F021B2196, ...) =>shm_semaphores_init: semctl init error: Invalid argument - trying again return 0x48 
0x3f0219057d: Calling free(0x369E9F10, 0x7DC6B67EC8, 0x3F021B2196, ...) => return 0x48 
0x3f0217d763: Calling semctl(0x812001, 0x0, 0x0, ...) => return 0x0 
0x3f0217d6f3: Calling semget(0x4D31727E, 0x8, 0x780, ...) => return 0x813001 
0x3f0217d71a: Calling semctl(0x813001, 0x0, 0x11, ...) => return 0xFFFFFFFFFFFFFFFF 
0x3f0217d729: Calling __errno_location(0x813001, 0x0, 0x11, ...) => return 0x7DC6E2CA10 
0x3f0217d730: Calling strerror(0x16, 0x0, 0x11, ...) => return 0x7DC6DC0200 
0x3f02190547: Calling vasprintf(0x7DC6B67FA8, 0x3F0223C60A, 0x7DC6B67FD8, ...) => return 0x47 
0x3f021903cd: Calling vprintf(0x3F0223ED78, 0x7DC6B67EC8, 0x3F021B2196, ...) =>shm_semap

Anyone has any idea about that ?

You are missing IPC or semaphore in your environement.

hey @ptitSeb ! thank you for your answer ! I don't think so : I've tried to proot with and without sysvipc integration (by default it's enabled).

Without it, I see a different error. I understand that there's no answer at all from the call (which sounds logical)

0x3f0217d6f3: Calling semget (/lib/aarch64-linux-gnu/libc.so.6)(0x4D318EF9, 0x8, 0x780, ...) => return 0xFFFFFFFFFFFFFFFF 
0x3f0217d662: Calling __errno_location (/lib/aarch64-linux-gnu/libc.so.6)(0x4D318EF9, 0x8, 0x780, ...) => return 0x73C29218C0 
0x3f0217d6f3: Calling semget (/lib/aarch64-linux-gnu/libc.so.6)(0x4D318EFA, 0x8, 0x780, ...) => return 0xFFFFFFFFFFFFFFFF 
0x3f0217d662: Calling __errno_location (/lib/aarch64-linux-gnu/libc.so.6)(0x4D318EFA, 0x8, 0x780, ...) => return 0x73C29218C0 
0x3f0217d6f3: Calling semget (/lib/aarch64-linux-gnu/libc.so.6)(0x4D318EFB, 0x8, 0x780, ...) => return 0xFFFFFFFFFFFFFFFF 
0x3f0217d662: Calling __errno_location (/lib/aarch64-linux-gnu/libc.so.6)(0x4D318EFB, 0x8, 0x780, ...) => return 0x73C29218C0 
0x3f0217d6f3: Calling semget (/lib/aarch64-linux-gnu/libc.so.6)(0x4D318EFC, 0x8, 0x780, ...) =>

But with it enabled, I've got the error mentioned above

0x3f0219057d: Calling free (./tis100.x86_64)(0x3782E430, 0x1007FDEC8, 0x3F021B2196, ...) => return 0x48 
0x3f0217d763: Calling my_semctl (./tis100.x86_64)(0x768001, 0x0, 0x0, ...) => return 0x0 
0x3f0217d6f3: Calling semget (/lib/aarch64-linux-gnu/libc.so.6)(0x4D31727E, 0x8, 0x780, ...) => return 0x769001 
0x3f0217d71a: Calling my_semctl (./tis100.x86_64)(0x769001, 0x0, 0x11, ...) => return 0xFFFFFFFFFFFFFFFF 
0x3f0217d729: Calling __errno_location (/lib/aarch64-linux-gnu/libc.so.6)(0x769001, 0x0, 0x11, ...) => return 0x709DD1E8C0 
0x3f0217d730: Calling strerror (/lib/aarch64-linux-gnu/libc.so.6)(0x16, 0x0, 0x11, ...) => return 0x709DE70200 
0x3f02190547: Calling my_vasprintf (./tis100.x86_64)(0x1007FDFA8, 0x3F0223C60A, 0x1007FDFD8, ...) => return 0x47 
0x3f021903cd: Calling my_vprintf (./tis100.x86_64)(0x3F0223ED78, 0x1007FDEC8, 0x3F021B2196, ...) =>shm_semaphores_init: semctl init error: Invalid argument - trying again return 0x48 5
0x3f0219057d: Calling free (./tis100.x86_64)(0x3782E4A0, 0x1007FDEC8, 0x3F021B2196, ...) => return 0x48 
0x3f0217d763: Calling my_semctl (./tis100.x86_64)(0x769001, 0x0, 0x0, ...) => return 0x0 
0x3f0217d6f3: Calling semget (/lib/aarch64-linux-gnu/libc.so.6)(0x4D31727E, 0x8, 0x780, ...) => return 0x76A001 
0x3f0217d71a: Calling my_semctl (./tis100.x86_64)(0x76A001, 0x0, 0x11, ...) => return 0xFFFFFFFFFFFFFFFF 
0x3f0217d729: Calling __errno_location (/lib/aarch64-linux-gnu/libc.so.6)(0x76A001, 0x0, 0x11, ...) => return 0x709DD1E8C0 
0x3f0217d730: Calling strerror (/lib/aarch64-linux-gnu/libc.so.6)(0x16, 0x0, 0x11, ...) => return 0x709DE70200

So I guess it's enabled (and I've looked in latest termux proot implementation and it says IPC and semaphore are enabled).

Any idea on how I could debug that ? Or find a workaround ?

Well

shm_semaphores_init: semctl init error: Invalid argument - trying again return 0x48 5

So I don't think semaphore are enabled.

Is it something that can be enabled or not in a distrib ? Or something related to proot configuration ? I'm pretty sure I've already launched this program in a termux proot but it was with an ubuntu image (this one is debian bookworm)

I don't know. You need to ask that in some termux discord / github.

OK, finally you pushed to do further investigation thank you :-D

I thought initially this error message was from box64 hence the confusion.

It was from Mono and export MONO_DISABLE_SHM=1 did the trick : https://lists.debian.org/debian-cli/2009/05/msg00008.html

Thanks anyway for your support !