[libc-commits] [libc] 11fb835 - [libc] Make LIBC_EXIT RPC code use quick exit
Joseph Huber via libc-commits
libc-commits at lists.llvm.org
Tue Oct 7 12:16:51 PDT 2025
Author: Joseph Huber
Date: 2025-10-07T14:16:34-05:00
New Revision: 11fb8358fab2796e6cdc5f85d24cc33696317b11
URL: https://github.com/llvm/llvm-project/commit/11fb8358fab2796e6cdc5f85d24cc33696317b11
DIFF: https://github.com/llvm/llvm-project/commit/11fb8358fab2796e6cdc5f85d24cc33696317b11.diff
LOG: [libc] Make LIBC_EXIT RPC code use quick exit
Summary:
This RPC call does the final exiting. The callbacks were handled on the
GPU side and this is only 'valid' in the pretend mode where we treat the
GPU like a CPU program. Doing this keeps us from crashing and burning
if people continue using the program while this is running as `exit`
would tear down the offloading library in memory and lead to segfaults.
This just drops everything where it is and lets the process manager
clean it up for us.
Added:
Modified:
libc/src/__support/RPC/rpc_server.h
Removed:
################################################################################
diff --git a/libc/src/__support/RPC/rpc_server.h b/libc/src/__support/RPC/rpc_server.h
index 4bd8a93526e3a..4c8242acafd28 100644
--- a/libc/src/__support/RPC/rpc_server.h
+++ b/libc/src/__support/RPC/rpc_server.h
@@ -395,7 +395,9 @@ LIBC_INLINE static rpc::Status handle_port_impl(rpc::Server::Port &port) {
port.recv([](rpc::Buffer *buffer, uint32_t) {
int status = 0;
__builtin_memcpy(&status, buffer->data, sizeof(int));
- exit(status);
+ // We want a quick exit to avoid conflicts with offloading library
+ // teardowns when called from the GPU.
+ quick_exit(status);
});
break;
}
More information about the libc-commits
mailing list