Skip to content

okrun 0.7.2 for linux-i686: an image an i386 image starts ends with status 127 before it is entered (x86_64 enters it) #46

Closed

Description

@speak-agent

What happens

Under okrun 0.7.2 for linux-i686 (openkal-platform 0.31.2's carrier, built as i686-linux-musl), an i386 image that starts an image ends that start with status 127 and no message. The same image starts a host program normally, and the x86_64 runner starts an image from an image normally (the fix of #42).

Measured with cmd (Sunrisepeak/cmd, the self path from argv[0], so %COMSPEC% is the image):

Started from inside the image x86_64-openkal i686-openkal
/bin/sh -c "exit 4" 4 4
/bin/true 0 0
"%COMSPEC%" /c exit 3 (the image itself) 3 127
the image run directly by okrun, /c exit 5 5 5

CI: https://github.com/Sunrisepeak/cmd/actions/runs/45036165363 (job i686-openkal: child=127).

Where it ends (strace -f of okrun i686)

The fork copy opens the image, reads the ELF header, the program headers and the OPENKAL note, maps the file, unmaps it, closes it, reads /proc/self, then calls exit_group(127):

openat(4, ".../bin/cmd.exe.oke", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 8
pread64(8, "\177ELF", 4, 0)     = 4
pread64(8, "\177ELF\1\1\1\0...", 64, 0) = 64
pread64(8, ..., 320, 52) = 320
mmap2(NULL, 1048576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x6df00000
pread64(8, "\10\0\0\0\20\0\0\0\1\0\0\0OPENKAL\0...", 4540, 372) = 4540
statx(8, "", ..., stx_size=1469896, ...) = 0
mmap2(NULL, 1469896, PROT_READ|PROT_WRITE, MAP_PRIVATE, 8, 0) = 0x6dd99000
munmap(0x6dd99000, 1469896)     = 0
close(8)                        = 0
getpid()                        = 3918097
readlinkat(AT_FDCWD, "/proc/self", "3918097", 24) = 7
exit_group(127)

No message is written before the exit, so the reason the loader gives up is not visible; on x86_64 the same path enters the image.

Reproduce

mcpp build --release --target i686-openkal          # mcpp 2026.11.22.1, openkal-platform 0.31.2
printf '@echo off\n"%%COMSPEC%%" /c exit 3\necho image=%%errorlevel%%\n' > E.BAT
mcpp run cmd.exe --release --target i686-openkal --file E.BAT -- /c E.BAT   # image=127; x86_64-openkal: image=3

cmd records the row at L1 (files) for now; its CI reports L2 by itself once this start works. Context: mcpp-community/mcpp#1005.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions