[safestack] Don't crash if stack size is not aligned as expected
Summary:
From runtime side looks it's OK to RoundUpTo to needed alignment as buffer is
going to be RoundUpTo to page size anyway.
Reviewers: eugenis, pcc
Subscribers: #sanitizers
Tags: #sanitizers
@@ -228,7 +228,7 @@ INTERCEPTOR(int, pthread_create, pthread_t *thread,
}
SFS_CHECK(size);
- SFS_CHECK((size & (kStackAlign - 1)) == 0);
+ size = RoundUpTo(size, kStackAlign);
SFS_CHECK((guard & (pageSize - 1)) == 0);
void *addr = unsafe_stack_alloc(size, guard);
