[libc-commits] [libc] [libc] fix issues around stack protector (PR #74567)

Schrodinger ZHU Yifan via libc-commits libc-commits at lists.llvm.org
Thu Dec 7 08:16:52 PST 2023


================
@@ -9,15 +9,17 @@
 #ifndef LLVM_LIBC_SRC___SUPPORT_OSUTIL_LINUX_QUICK_EXIT_H
 #define LLVM_LIBC_SRC___SUPPORT_OSUTIL_LINUX_QUICK_EXIT_H
 
-#include "syscall.h"             // For internal syscall function.
+#include "syscall.h" // For internal syscall function.
 
 #include "src/__support/common.h"
 
 #include <sys/syscall.h> // For syscall numbers.
 
 namespace LIBC_NAMESPACE {
 
-LIBC_INLINE void quick_exit(int status) {
+// mark as no_stack_protector since TLS can be torn down before calling
+// quick_exit
+__attribute__((no_stack_protector)) LIBC_INLINE void quick_exit(int status) {
----------------
SchrodingerZhu wrote:

I tried just now: it seems that `[[clang::no_stack_protector]]` works but `[[gnu::no_stack_protector]]` is not recognized by `clang`.

https://github.com/llvm/llvm-project/pull/74567


More information about the libc-commits mailing list