OSDN Git Service

pthread: Invalidate stale stack pointers on pthread_exit()
authorBjorn Andersson <bjorn.andersson@sonymobile.com>
Fri, 4 May 2012 00:12:39 +0000 (17:12 -0700)
committerBjorn Andersson <bjorn.andersson@sonymobile.com>
Wed, 9 May 2012 00:43:57 +0000 (17:43 -0700)
commit0753dc653eb3b84d3490212437e7490975d4c020
tree19e15b19489d3b3031b11256aee077f29cb9cccc
parent3919b96eccb6d78f71f6d19b3ebfacec93cbca1f
pthread: Invalidate stale stack pointers on pthread_exit()

A call to pthread_key_delete() after pthread_exit() have unmapped the stack of a thread
but before the ongoing pthread_join() have finished executing will result in an access
to unmapped memory.
Avoid this by invalidating the stack_base and tls pointers during pthread_exit().

This is based on the investigation and proprosed solution by
Srinavasa Nagaraju <srinavasa.x.nagaraju@sonyericsson.com>

Change-Id: I145fb5d57930e91b00f1609d7b2cd16a55d5b3a9
libc/bionic/pthread.c