diff options
author | Ulrich Drepper <drepper@redhat.com> | 2003-03-14 06:11:06 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2003-03-14 06:11:06 +0000 |
commit | 59b28a2e4b51c293025c157c62bfc27b633aee19 (patch) | |
tree | ccecb4e1af628dcf6715dce049af905437e684b7 /nptl | |
parent | 3be9dc8e1471fcf5f461d31e8492d14046ab26c3 (diff) | |
download | glibc-59b28a2e4b51c293025c157c62bfc27b633aee19.tar.gz glibc-59b28a2e4b51c293025c157c62bfc27b633aee19.tar.xz glibc-59b28a2e4b51c293025c157c62bfc27b633aee19.zip |
(allocate_stack): If MULTI_PAGE_ALIASING is defined and the size of the stack which must be allocated is a multiple, allocate one more page.
Diffstat (limited to 'nptl')
-rw-r--r-- | nptl/allocatestack.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/nptl/allocatestack.c b/nptl/allocatestack.c index a43d94a0cd..14a2ab09df 100644 --- a/nptl/allocatestack.c +++ b/nptl/allocatestack.c @@ -379,6 +379,15 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp, pd = get_cached_stack (&size, &mem); if (pd == NULL) { + /* To avoid aliasing effects on a larger scale then pages we + adjust the allocated stack size if necessary. This way + allocations directly following each other will not have + aliasing problems. */ +#if MULTI_PAGE_ALIASING != 0 + if ((size % MULTI_PAGE_ALIASING) == 0) + size += pagesize_m1 + 1; +#endif + mem = mmap (NULL, size, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANONYMOUS | ARCH_MAP_FLAGS, -1, 0); |