You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
The first stack is 64 KiB, and a program that outgrows it hangs without a fault #3
Observed (openkal-platform 0.28.1, row i686-dos-musl, DOSBox Staging 0.83.0 with CWSDPMI, run through dirun 0.4.0):
A program whose stack grows past 64 KiB does not fault. It hangs until the runner's time limit ends it, and any output it had not yet flushed to a file is lost. A program that ran a few levels of calls with several 4 KiB path buffers on the stack hung on a later, unrelated call (closedir). This first looked like a bug in the batch commands that ran just before that call.
hangs; ended by the runner's time limit (status 124), no fault reported
For comparison, on the same row abort() exits with 134, a detected double free faults with #PF, and __builtin_trap() faults with #UD. Only stack exhaustion goes unreported.
Where it comes from
stub/stub.S sets FIRST_STACK to 0x10000, and the README describes the executable's first stack as 64 KiB, allocated in the same block as the loadable segments. Nothing stops the stack from growing past its end, so an overflow writes into the neighbouring memory of the block rather than faulting.
Suggested
A first stack sized like other hosted systems' main-thread stacks (1 MiB, as on Windows, or more), or a size the executable states, for example a note or PT_GNU_STACK's size, read by the stub.
Make an overflow a fault rather than silent corruption. For example, place the stack at the low end of the block so that growing past it leaves the descriptor's range, or give the stack its own expand-down descriptor. That way a deep call reports #SS or #PF the way the other faults are reported.
Fixed in openkal-dos 0.1.1 (and openkal-dos-tools 0.1.1), in the version group of openkal-platform 0.29.1:
The stub sizes the program's first stack from PT_GNU_STACK (lld's -z stack-size); without it the stack is 1 MiB. openkal-platform 0.29.1 links i686-dos-musl with -z stack-size=1048576.
Below the stack lies a guard page, uncommitted through DPMI 0507h, so an overflow is a reported #PF rather than silent corruption. Where the host lacks 0507h, a canary at the stack's floor is checked at exit, and a line at start says the guard page is unavailable.
Measured: openkal-platform's checks/dos runs a recursion 64 deep (the reproduction's 8 KiB frames); an external verification project's whole batch script, the program that first hung here, now runs to the end on i686-dos-musl under DOSBox Staging 0.83.0 through dirun 0.6.0.
Activity
speak-agent commentedon Nov 17, 2026
Fixed in openkal-dos 0.1.1 (and openkal-dos-tools 0.1.1), in the version group of openkal-platform 0.29.1:
PT_GNU_STACK(lld's-z stack-size); without it the stack is 1 MiB. openkal-platform 0.29.1 linksi686-dos-muslwith-z stack-size=1048576.#PFrather than silent corruption. Where the host lacks 0507h, a canary at the stack's floor is checked at exit, and a line at start says the guard page is unavailable.Measured: openkal-platform's
checks/dosruns a recursion 64 deep (the reproduction's 8 KiB frames); an external verification project's whole batch script, the program that first hung here, now runs to the end oni686-dos-muslunder DOSBox Staging 0.83.0 through dirun 0.6.0.