Skip to content

Detect exit() from coroutine/fiber alternate stack and convert to emu quit#3571

Open
zqb-all wants to merge 1 commit intoptitSeb:mainfrom
zqb-all:exit-outside-stack
Open

Detect exit() from coroutine/fiber alternate stack and convert to emu quit#3571
zqb-all wants to merge 1 commit intoptitSeb:mainfrom
zqb-all:exit-outside-stack

Conversation

@zqb-all
Copy link
Contributor

@zqb-all zqb-all commented Feb 26, 2026

When exit() is called with RSP outside the known main stack range (emu->init_stack/size_stack), convert to emu->quit instead of killing the process. This handles custom coroutine libraries that call exit() as a safety fallback from alternate stacks.

… quit

When exit() is called with RSP outside the known main stack range
(emu->init_stack/size_stack), convert to emu->quit instead of killing
the process. This handles custom coroutine libraries that call exit()
as a safety fallback from malloc'd alternate stacks.
@ptitSeb
Copy link
Owner

ptitSeb commented Feb 26, 2026

I am wondering if that code

emu->quit = 1;
R_EAX = code;

should be how my_exit should be handled all the time. I'll do some testing on my side before merging this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants