bug-glibc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Off by one error in pthread.c


From: Ken Leider
Subject: Off by one error in pthread.c
Date: Tue, 17 Apr 2001 13:07:53 -0500

Looking at the glibc-2.2.2 linux threads code, I noticed that __pthread_manager_thread_tos is placed one word beyond the memory allocated to the thread stack.

pthread.c:502
  /* Setup stack for thread manager */
  __pthread_manager_thread_bos = malloc(THREAD_MANAGER_STACK_SIZE);
  if (__pthread_manager_thread_bos == NULL) return -1;
  __pthread_manager_thread_tos =
    __pthread_manager_thread_bos + THREAD_MANAGER_STACK_SIZE;
------------------------
THREAD_MANAGER_STACK_SIZE is set to 2*pagesize - 32 in internals.h. This was done to account for allocation overhead. I wonder if this calculation will still be correct on a 64 bit machine. I noticed the above issue because I am writing an allocator for itanium and some of my data was being overwritten, which never happened on a 32 bit machine.

Thank you




reply via email to

[Prev in Thread] Current Thread [Next in Thread]