[compiler-rt] r353482 - [safestack] Explain why tinfo at the end of the buffer
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 7 15:20:47 PST 2019
Author: vitalybuka
Date: Thu Feb 7 15:20:47 2019
New Revision: 353482
URL: http://llvm.org/viewvc/llvm-project?rev=353482&view=rev
Log:
[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
Modified:
compiler-rt/trunk/lib/safestack/safestack.cc
Modified: compiler-rt/trunk/lib/safestack/safestack.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/safestack/safestack.cc?rev=353482&r1=353481&r2=353482&view=diff
==============================================================================
--- compiler-rt/trunk/lib/safestack/safestack.cc (original)
+++ compiler-rt/trunk/lib/safestack/safestack.cc Thu Feb 7 15:20:47 2019
@@ -228,6 +228,8 @@ INTERCEPTOR(int, pthread_create, pthread
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;
More information about the llvm-commits
mailing list