Email List: Xaustin-review-lX
[All Lists]

Defect in XSH pthread_attr_getstack()

To: yyyyyyyyyyyyyyy@xxxxxxxxxxxxx
Subject: Defect in XSH pthread_attr_getstack()
From: yyyyyyy@xxxxxxxxxx
Date: Thu, 1 May 2003 19:54:38 +0100 (BST)
        Defect report from : Ulrich Drepper , Red Hat, Inc.

(Please direct followup comments direct to yyyyyyyyyyyyyy@xxxxxxxxxxxxx)

@ page 996 line 31706 section pthread_attr_getstack() objection {ud-stackaddr}

Problem:

Edition of Specification (Year): 2003

Defect code :  2. Omission

This applies to the pthread_attr_setstackaddr() function as well but I
don't file two bugs.  Both pages can get the same change if necessary.


The use of a user-specified stack for a thread has been identified as
problematic in the past.  Once a thread terminates, how to determine
the thread stack is unused?  pthread_join() doesn't guarantee that.
I don't think this has been exactly specified since it's not generally
possible.

Anyway, a related problem is: what is the status of the stack before
the thread is created?  This is especially important with situations
where the creation of the thread is not directly under the user's
control (e.g., when SIGEV_THREAD is used for AIO or timers).


One possible solution for the problem is to say that the stack is under
the implementations control right after the pthread_attr_setstack() call
until either a thread is created using the attribute and the thread
terminated, or the attribute is destroyed before a thread is created.

The latter phrase covers the AIO and timer case: if a the attribute is
destroyed while the AIO request is still outstanding (or the timer is
still running) the memory pointed to by the attribute becomes invalid
which (according to ERN XSH 79) makes the AIO (and by extension timer)
behavior unspecific.

Action:

Add after lines 31705:

After a successful call of pthread_attr_setstack(), the storage area
specified by the stackaddr parameter to pthread_setstack is under the
control of the implementation.  It must not be used before either the
thread created with this attribute terminated or pthread_attr_destroy()
has been called to destroy the attribute before a thread has been
created using this attribute.


For pthread_attr_setstackaddr() add after line 31759:

After a successful call of pthread_attr_setstackaddr(), the storage area
specified by the stackaddr parameter to pthread_setstack is under the
control of the implementation.  It must not be used before either the
thread created with this attribute terminated or pthread_attr_destroy()
has been called to destroy the attribute before a thread has been
created using this attribute.

<Prev in Thread] Current Thread [Next in Thread>
  • Defect in XSH pthread_attr_getstack(), drepper <=