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
// We do NOT have stack overflow handler, because TEE OS will kill TA when it happens.
// So cleanup is commented
// stack_overflow::cleanup();
}
This function is always invoked after main. The unsupported.rs implementation is to just do nothing, but this is panicking instead. Even if it is somehow intentional, an rtabort call would surely be much more appropriate in this context, given that unimplemented involves a call to the global allocator and panic hook.
The comment above that says that Teeos uses dylibs rather than executables for "trusted applications", so cleanup() should in fact be unreachable. Using unreachable!() in init and cleanup would make sense in that case.
Interesting. However, the function is also called in std::process::exit (although IIRC that can panic anyway on multiple platforms). So it is reachable. Edit: nvm, it panics before that. Edit: nvm my nvm, cleanup is called first
Activity
RalfJung commentedon Sep 16, 2026
Added in #116565.
Cc @Sword-Destiny @petrochenkov
bjorn3 commentedon Sep 16, 2026
The comment above that says that Teeos uses dylibs rather than executables for "trusted applications", so
cleanup()should in fact be unreachable. Usingunreachable!()ininitandcleanupwould make sense in that case.maxdexh commentedon Sep 16, 2026
Interesting. However, the function is also called in
std::process::exit(although IIRC that can panic anyway on multiple platforms). So it is reachable.Edit: nvm, it panics before that.Edit: nvm my nvm,cleanupis called firstIn any case, this should not panic IMO.
maxdexh commentedon Sep 16, 2026
And teeos is apparently one of these ^^
rust/library/std/src/sys/exit.rs
Lines 94 to 111 in 28e8a8c
IMO, an unconditional panic for
std::process::exitis also inappropriate and should be replaced withrtabort.