This is an archive of the discontinued LLVM Phabricator instance.

[LIBC] Cleanup code in `thread_exit`
ClosedPublic

Authored by goldstein.w.n on May 22 2023, 12:43 PM.

Details

Summary
  1. Avoid proper function calls and referencing local variables after

the stack has been deallocated. A proper function call/return or local
variable reference that may have spilled will cause invalid memory
reads after the stack has been deallocated.

  1. Mark the function as [[noreturn]] and place

__builtin_unreachable() after the SYS_exit syscalls.

Diff Detail