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

Nick Desaulniers via libc-commits libc-commits at lists.llvm.org
Tue Dec 12 09:05:32 PST 2023


================
@@ -9,15 +9,22 @@
 #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 for x86 since TLS can be torn down before calling
+// quick_exit so that the stack protector canary cannot be loaded.
+#if defined(__i386) || defined(__i386__) || defined(__x86_64__) ||             \
+    defined(__x86_64)
+__attribute__((no_stack_protector))
----------------
nickdesaulniers wrote:

can we use `[[]]` style attributes rather than the older extension?

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


More information about the libc-commits mailing list