LinuxThreads' stacks can collide with malloc

Ulrich Drepper drepper@redhat.com
Wed Nov 15 09:38:00 GMT 2000


Wolfram Gloger <wmglo@dent.med.uni-muenchen.de> writes:

> The stacks are unmapped at thread exit time, so if a stack region is
> later occupied by e.g. malloc, and still later another thread is
> started, it may corrupt the heap due to the use of MAP_FIXED to
> re-claim the stack region.

You mean the kernel allows to mmap() with MAP_FIXED in a place below
the sbrk?  This sounds like a kernel bug.

> I noticed that FLOATING_STACKS can only be enabled on i686.  Wouldn't
> the ldt tricks work on i586, too?

It does.  Most people only build i386 and i686 versions.  I wanted to
have a way to get the version without LDT use and one with.  In
addition, I've never looked at the performance of the ldt use on
anything but i686.  I think these usages were improved in modern CPUs
since M$ is using this method, too.  On older versions it's dog slow.
We can of course change it to use this also for i586 but I want some
evidence that this is really wanted.

-- 
---------------.                          ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Red Hat          `--' drepper at redhat.com   `------------------------


More information about the Libc-hacker mailing list