[libc-commits] [libc] Supporting stack protectors in linux x86-64 (PR #66456)
Siva Chandra via libc-commits
libc-commits at lists.llvm.org
Mon Sep 18 13:55:35 PDT 2023
================
@@ -54,7 +57,9 @@ void init_tls(TLSDescriptor &tls_descriptor) {
// Per the x86_64 TLS ABI, the entry pointed to by the thread pointer is the
// address of the TLS block. So, we add more size to accomodate this address
// entry.
- uintptr_t tlsSizeWithAddr = tlsSize + sizeof(uintptr_t);
+ // We also need to include space for the stack canary. The canary is at
+ // offset 0x28 (40) and is of size uintptr_t.
+ uintptr_t tlsSizeWithAddr = tlsSize + sizeof(uintptr_t) + 40;
----------------
sivachandra wrote:
Shouldn't another `sizeof(uintptr_t)` worth of size be added to accommodate the stack guard value?
https://github.com/llvm/llvm-project/pull/66456
More information about the libc-commits
mailing list