aboutsummaryrefslogtreecommitdiff
path: root/linuxthreads
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-12-31 07:39:50 +0000
committerUlrich Drepper <drepper@redhat.com>2000-12-31 07:39:50 +0000
commit09f5e1635ae75de077c5307d02fdbefc4b0c7144 (patch)
treeb328e9ca3e582fd022a6832277f764b20f0586cf /linuxthreads
parentc77a447822c8ccc6866216bad737189fff3a0b93 (diff)
downloadglibc-09f5e1635ae75de077c5307d02fdbefc4b0c7144.tar
glibc-09f5e1635ae75de077c5307d02fdbefc4b0c7144.tar.gz
glibc-09f5e1635ae75de077c5307d02fdbefc4b0c7144.tar.bz2
glibc-09f5e1635ae75de077c5307d02fdbefc4b0c7144.zip
Update.
2000-12-28 Wolfram Gloger <wg@malloc.de> * malloc/malloc.c (MALLOC_COPY): Handle case if source and destination overlap. Assume dest is always below source if overlapping.
Diffstat (limited to 'linuxthreads')
-rw-r--r--linuxthreads/ChangeLog5
-rw-r--r--linuxthreads/manager.c31
2 files changed, 21 insertions, 15 deletions
diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog
index 176099431b..2bb9371912 100644
--- a/linuxthreads/ChangeLog
+++ b/linuxthreads/ChangeLog
@@ -1,3 +1,8 @@
+2000-11-15 Wolfram Gloger <wg@malloc.de>
+
+ * manager.c (pthread_free): [!FLOATING_STACKS]: Only remap the
+ stack to PROT_NONE, don't unmap it, avoiding collisions with malloc.
+
2000-12-27 Andreas Jaeger <aj@suse.de>
* Examples/ex13.c: Make local functions static.
diff --git a/linuxthreads/manager.c b/linuxthreads/manager.c
index 37f426759f..8442629c08 100644
--- a/linuxthreads/manager.c
+++ b/linuxthreads/manager.c
@@ -418,7 +418,7 @@ static int pthread_allocate_stack(const pthread_attr_t *attr,
new_thread_bottom = (char *) map_addr + guardsize;
new_thread = ((pthread_descr) (new_thread_bottom + stacksize)) - 1;
-# else
+# else /* !FLOATING_STACKS */
if (attr != NULL)
{
guardsize = page_roundup (attr->__guardsize, granularity);
@@ -696,23 +696,24 @@ static void pthread_free(pthread_descr th)
{
size_t guardsize = th->p_guardsize;
/* Free the stack and thread descriptor area */
-#ifdef NEED_SEPARATE_REGISTER_STACK
char *guardaddr = th->p_guardaddr;
- /* We unmap exactly what we mapped, in case there was something
- else in the same region. Guardaddr is always set, eve if
- guardsize is 0. This allows us to compute everything else. */
+ /* Guardaddr is always set, even if guardsize is 0. This allows
+ us to compute everything else. */
size_t stacksize = (char *)(th+1) - guardaddr - guardsize;
- /* Unmap the register stack, which is below guardaddr. */
- munmap((caddr_t)(guardaddr-stacksize),
- 2 * stacksize + th->p_guardsize);
+#ifdef NEED_SEPARATE_REGISTER_STACK
+ /* Take account of the register stack, which is below guardaddr. */
+ guardaddr -= stacksize;
+ stacksize *= 2;
+#endif
+#if FLOATING_STACKS
+ /* Can unmap safely. */
+ munmap(guardaddr, stacksize + guardsize);
#else
- char *guardaddr = th->p_guardaddr;
- /* We unmap exactly what we mapped, in case there was something
- else in the same region. Guardaddr is always set, eve if
- guardsize is 0. This allows us to compute everything else. */
- size_t stacksize = (char *)(th+1) - guardaddr - guardsize;
-
- munmap (guardaddr, stacksize + guardsize);
+ /* Only remap to PROT_NONE, so that the region is reserved in
+ case we map the stack again later. Avoid collision with
+ other mmap()s, in particular by malloc(). */
+ mmap(guardaddr, stacksize + guardsize, PROT_NONE,
+ MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0);
#endif
}
}