[safestack] Explain why tinfo at the end of the buffer

Reviewers: pcc, eugenis, vlad.tsyrklevich

Reviewed By: vlad.tsyrklevich

Subscribers: llvm-commits, jfb, #sanitizers

Tags: #sanitizers, #llvm

Differential Revision: https://reviews.llvm.org/D57863

llvm-svn: 353482
This commit is contained in:
Vitaly Buka 2019-02-07 23:20:47 +00:00
parent 539e6aa421
commit 871b2bd980
1 changed files with 2 additions and 0 deletions

View File

@ -228,6 +228,8 @@ INTERCEPTOR(int, pthread_create, pthread_t *thread,
size = RoundUpTo(size, kStackAlign);
void *addr = unsafe_stack_alloc(size, guard);
// Put tinfo at the end of the buffer. guard may be not page aligned.
// If that is so then some bytes after addr can be mprotected.
struct tinfo *tinfo =
(struct tinfo *)(((char *)addr) + size - sizeof(struct tinfo));
tinfo->start_routine = start_routine;